Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to make a compressed file of my web sites folder and send it to a backups folder, and I can't seem to find anything specific on google.

  • My web folder is: /home/user/public_html/mydomain.com/
  • Backups folder is: /home/user/backups/

Some Concerns:

  1. Would there be any issues gziping while nginx/apache running?
  2. Also I have the permission set to 755, is this ok?
  3. Do I need to tarball before I gzip it?
  4. Will this overwrite a previous gzip?
  5. Is there a way to automatically append the date?...That would be great!

I have been manually doing this in Cyberduck ... what a pain!

share|improve this question
up vote 5 down vote accepted
  1. It is always smart to stop anything that touches the files you want to backup. If files are changed during the creation of the backup you can not predict the outcome of restoring the backup: it might break data.

  2. Yes.

  3. No, but you will get seperate gzip'd files if you do not.

  4. Yes if the names are the same.

  5. Yes. A filename like backup_$(date '+%F_%T').gz will have both date and time as part of your filename beginning with backup_.

share|improve this answer
    
Thanks! much appreciated! – SkinnyGeek1010 May 15 '11 at 21:12

tar.bz2 is a better compression tool imho.

tar -jcvf website.tar.bz2 /home/user/public_html/mydomain.com/
share|improve this answer
    
Cool, I will look into .bz2! – SkinnyGeek1010 May 15 '11 at 20:15

You can also try zip file using the below command:

Install zip utility if not installed:

zip -r backupfilename.zip /home/user/public_html/mydomain.com 

Or

zip -r file_name_backup_date '+%F_%T'.zip /home/user/public_html/mydomain.com 

To unzip the file

unzip backupfilename.zip
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.