Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 03-19-2008, 08:12 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tar -cjfp sitebackup.bz2 /full/path/to/folder/htdocs

that this line does not work makes sense.

f = filename
p = Preserve (only usefull on a restore!)

by using "-cjfp " you are telling the tar command that it should out put a file (because of the f-flag) and that the name of that file is 'p' (the string immediately following the f-flag).

PS I suggest you do not tar a fullpath, but rather a relative path, as this will make restoring to a different location much easier.

Use:

cd /full/path/to/folder/htdocs
tar -cvzf sitebackup.tar.gz . <-- Use this if your forum is in the root of htdocs
or:
tar -cvzf sitebackup.tar.gz ./forum <-- Use this if your forum is in the 'forum' subdirectory of htdocs
Reply With Quote
  #12  
Old 03-19-2008, 08:32 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use this command as part of my backup cronjobs:
Code:
tar -czf /home/user/backups/data-`date --iso-8601`.tar.gz -C /home/user htdocs vbalbumpic vbattach
I may get around to releasing the whole code (which automatically deletes backups older than X days).
Reply With Quote
  #13  
Old 03-19-2008, 08:53 AM
snakes1100 snakes1100 is offline
 
Join Date: Dec 2001
Location: Michigan
Posts: 3,733
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

-f, --file=ARCHIVE - this is telling it to use the file/archive name you are giving in the command, so how does that not make sense to you marco?

-p - it doesnt matter if you use it while compressing or uncompressing, it just preserves the ownership/permissions and will do no harm if its there while compressing

if you want to delete backups older than 5/10/15/20/25/30 days, you can simply use this in your cron job, simply change the number after the + in the command below.

cd /$backupdir

find /$backupdir -atime +30 -exec rm -rf {} \;

You can place that that the end of your cron file for backups
Reply With Quote
  #14  
Old 03-19-2008, 09:13 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by snakes1100 View Post
-f, --file=ARCHIVE - this is telling it to use the file/archive name you are giving in the command, so how does that not make sense to you marco?
Where did i say that using the f-flag doesn't make sense? I only commented on the fact that the p-flag was following the f-flag, making 'p' the filename to use.

Quote:
Originally Posted by snakes1100 View Post
-p - it doesnt matter if you use it while compressing or uncompressing, it just preserves the ownership/permissions and will do no harm if its there while compressing
The p-flag does not do anything when creating the archive. In the best situation it is ingnored, worse case the command will return an error (depending on the distribution/implementation)
Reply With Quote
  #15  
Old 03-19-2008, 09:34 AM
snakes1100 snakes1100 is offline
 
Join Date: Dec 2001
Location: Michigan
Posts: 3,733
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I never said it did anything while creating a archive, as long as it isnt at the end as he did it, its fine, just like the v switch isnt needed in the command.
Reply With Quote
  #16  
Old 03-19-2008, 10:28 AM
webspawner webspawner is offline
 
Join Date: Dec 2007
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I try tar -cvzf sitebackup.tar.gz .

it tars all file/folders into a folder called ./htdocs/contents

I need to just extract to /contents *** (as the new host has a public_html not htdocs)

So if i opened the new tar'd file I would just see the contents.

When im in htdocs and i try tar -cvzf sitebackuphtdocs.tar.gz

i get
tar: Cowardly refusing to create an empty archive

What is the command for this because when I try tar -cvzf sitebackup.tar.gz full/path/to/folder/htdocs

when i open the archive i get full/path/to/folder/htdocs/contents**

and when im in the htdocs and do tar -cvzf sitebackup.tar.gz
Reply With Quote
  #17  
Old 03-19-2008, 10:31 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
When im in htdocs and i try tar -cvzf sitebackuphtdocs.tar.gz
You forgot the period (.) at the end.
Reply With Quote
  #18  
Old 03-19-2008, 08:52 PM
webspawner webspawner is offline
 
Join Date: Dec 2007
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried again (with period)

tar -cvzf sitesfiles.tar.gz .

and it went through the list of files/folders that it was tar'ing but the last lines were:

./sitesfiles.tar.gz
tar: ./sitesfiles.tar.gz: file changed as we read it

That appears to of TAR'd/zipped it still but when i open the TAR'd file (when downloaded) I have to click the directory
' . '(period) before seeing the contents

I wants the contents to be listed as soon as the TAR folder is opened

Any idea's? and do the few lines mentioned above after matter? f(ile changed as we read it)

thanks,
Reply With Quote
  #19  
Old 03-19-2008, 09:50 PM
snakes1100 snakes1100 is offline
 
Join Date: Dec 2001
Location: Michigan
Posts: 3,733
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As i posted before, you have a file thats being wrote to while your tar'ing the htdocs folder, do you have logs files or stats files in there?

If so you need to stop the program that is writing to the file or use the --exclude switch in the tar command.
Reply With Quote
  #20  
Old 03-19-2008, 09:52 PM
webspawner webspawner is offline
 
Join Date: Dec 2007
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help.

Could you please provide me with a full command and tell me where to try it from

maybe the directory before htdocs?

could you give me full command?

Also I wants the TAR'd file to display the contents of htdocs not a folder then contents.

thanks in advance

PS is there also a way to retain permissions - the previous command you gave me didnt work.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04206 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete