Automated Backups for VPS via Rsync

LB79

New Member
Well guys, I figure this is something that we can ALL find useful since we run websites on mostly VPSs. Maybe I can edit this thread once my questions have been answered into a clear-cut tutorial for others.

I've got Rsync set up and working with the command:

rsync -ravz -e "ssh -p 10286 -i /root/.ssh/id_dsa" root@MYIPADDRESS:/home/www/ /home/www/

That copied over a full copy of my /home/www directory from my Main VPS into my Backup VPS.

But what is the difference between -archive (-a) and -backup (-b)?

My goal is to have it create a weekly backup into a new folder/zip file.
IE: 08.01.2011, 08.08.2011, 08.15.2011, etc, I know I can use Cron jobs to run the command, but what is the correct command to do that?

Thanks! -a is archive which does the job of "rlptgoD" options i.e. recursive, links, permissions, time, group, ownership, devices.
-b is not really necessary.

To create a weekly backup, set a cronjob to execute the following rsync command once in a week:

Quote: rsync -ravz -e "ssh -p 10286 -i /root/.ssh/id_dsa" root@MYIPADDRESS:/home/www/ /home/www/$(date +"%d-%m-%Y")/ Change the date format above as per your requirement.
 
Back
Top