From: Joe L. <la...@sc...> - 2005-08-30 23:24:35
|
I wrote a few scripts to help turn flexbackup into a disk-to-usbdisk backup system, maintaining a set duration of backups. You could accomplish much the same thing with some fancy crontab+shell scripts, but I prefer using Perl for anything moderately or more so complex. The first is rmob.pl at http://downloads.scalableinformatics.com/downloads/backup/rmob.pl . It will look over the names in the directory pointed to by --dir=/path/to/backup/files and remove any that are older than --age=number_of_days . By default it will work in the current directory and remove only the back files that are older than 30 days. The second is rotate_backup.pl, which will adjust a soft link to the backup directory (as specified in the /etc/flexbackup.conf file), to point to one of several usbdisk units hanging off /media/usbdisk1, /media/usbdisk2, ... , /media/usbdiskN . Based upon the number of disks (hardwired on the 6th line of the script), and the number of days in a month (hardwired to 31), it will "evenly" divide the month into 31/N slices, and set an index equal to the integer portion of (1+31/N) which is then used to construct the soft link to the appropriate USB2 hard disk. You can set the particular directory where your usbdisk are mounted using the --dir=/path/to/usbdisk which the script will use as a template to create the soft link to --link=/path/to/link/to/for/backup . Couple these two with a few USB2 drives, and a hotplug system that mounts things like this in /media/usbdisk*, as well as a flexbackup config which always backs up to the link (/media/backup in this case), and some simple crontabs 05 0 * * * /usr/sbin/rotate_backup.pl > /srv/backup/rotate-`date -I`.log 2>&1 5 0 * * * /usr/sbin/rmob.pl --age 15 --dir /media/backup 30 0 1,15 * * /usr/bin/flexbackup -set all > /srv/backup/backup-all-`date -I`.log 2>&1 30 0 2-14,16-31 * * /usr/bin/flexbackup -set user -level differential > /srv/backup/backup-user-`date -I`.log 2>&1 30 6 2-14,16-31 * * /usr/bin/flexbackup -set system -level differential > /srv/backup/backup-system-`date -I`.log 2>&1 (note: you could simply do incremental backups rather than differentials) and you have a rather complete rotating backup system to USB2 media. Quite simple really. Joe -- Joseph Landman, Ph.D Founder and CEO Scalable Informatics LLC, email: la...@sc... web : http://www.scalableinformatics.com phone: +1 734 786 8423 fax : +1 734 786 8452 cell : +1 734 612 4615 |