What is the best way to perform daily/weekly/monthly backups?

I am currently running a script in leopard every few days to make sure I have backed up my data on a remote server using:

#!/bin/bash
rsync -avvz ~/Documents ~/Workspace -e ssh [email protected]:~/Backup/

There are limitations to this method i.e. I can't look at files that have been deleted a few backups ago. What is the best way to automate this process?


Solution 1:

Can you set up a cron job in leopard?

The example rsync options (-avvz) don't delete files in the 'remote' directory which have been removed from the local directory since an earlier backup. They should still be in the remote directory.

But your example is confusing: are you copying files from ~/Documents to ~/Workspace or to ~/Backup/ on myhost.com

This may be a peculiarity of leopard, but it looks like you're just copying from ~/Documents to ~/Workspace in which case the rest of the line might be ignored (and you don't need to invoke ssh)

You should also consider ending the source directory specification with a /

I would agree with Peter that rotating backups are good — if you have the available disk space.

Solution 2:

You're looking for rdiff-backup. It is very, very good.

Solution 3:

I have found the package rsnapshot to be very good, available in all the distros and i've just now installed it on my mac.

It's a wrapper for rsync that takes care of incremental backups including hourly, daily, weekly and monthly.