|
|
| mn :: comp :: tools :: It was just here... | |
Nothing here that isn't elsewhere too, but I recently got to the point where I had to be able to have a real grown-up backup system, and it was more fun / easier to write my own script than to modify someone else's. I read the following sites before starting:
Since I was already using rsync, all I really had to do was add versioning. I wrote this script: backup_shuffle.pl and set up some cron jobs. Example from a client:
20 3 * * * $HOME/bin/rsync-script.sh
Example from the server:
10 1 * * * /home/jack/bin/backup_shuffle.pl /mnt/backup jack 8 20 1 * * * /home/jack/bin/backup_shuffle.pl /mnt/backup cletus 8 20 2 * * * $HOME/bin/rsync-script.sh
Those rsync-script.sh files are very simple, but are necessary for testing that rsync isn't already running. If you accidentally create circular references with symlinks or something equally horrible that causes multiple rsyncs to start running, bad things happen. I managed to get system load up to 137 and lock up the backup disk entirely with 16 looping rsync processes :-). Script as follows:
#!/bin/sh
#[ '/sbin/pidof rsync' ] && exit 0 -- this is too elegant to work reliably apparently...
if [ '/sbin/pidof rsync' != "" ]; then
exit 0
fi
rsync -a --delete --exclude fs1home /home/jack/ /mnt/backup/jack/
Note that exclude statement, you can use multiple iterations (e.g. --exclude foo --exclude bar) as well. Excluding things that are remote mounts and symlinks is a good idea.
|
Last modified: Oct 24, 2008 2:28 pm.
|
||
|
|