Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server (Linux) with NAS which is mounted as folder "mount" I have website in "public_html" folder.

I want to take backup of website in mount folder automatically at certain intervals for e.g. every hour. I read that there is something called "rsync" which is used to make two folders sync. And it doesn't copy all files every time and instead matches if the file has been changed and then only update changed files. How do I use it to make automatic backups? I have root access to server.

Thanks

share|improve this question

migrated from stackoverflow.com Dec 22 '10 at 15:50

This question came from our site for professional and enthusiast programmers.

1  
Have you even tried googling "rsync tutorial"? –  darioo Dec 22 '10 at 14:51

2 Answers 2

Setup a cron that looks like this:

0 * * * * rsync -rltv [source] [destination]

This says, every hour sync the source directory to the destination directory (only sending changed files)

The flags mean:

  • r - recursive
  • l - copy symlinks as symlinks
  • t - preserve modification times
  • v - increase verbosity
share|improve this answer
    
Maybe also look into the -a option, as per OP's needs. –  Victor Dec 22 '10 at 14:55

I think it's better for you to have some knowledge about rsync and crons. Then, you can plan how you are going to deploy your backup solution.

First of all take a look a detailed explanation about rsync: http://www.sysresccd.org/Sysresccd-manual-en_Backup_and_transfer_your_data_using_rsync

If you want to create automatic tasks like backups, read about cron jobs: http://adminschoice.com/crontab-quick-reference

There are another network backup solutions like Bacula.

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.