Automated Backups for VPS via Rsync

Status
Not open for further replies.

LuDo8

Active Member
402
2010
39
0
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!
 
1 comment
-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:

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.
 
Status
Not open for further replies.
Back
Top