[NTLUG:Discuss] Bash/rsync script help.
CoryC
oakleeman at yahoo.com
Mon Mar 16 11:02:15 CDT 2009
I have an Openfiler NAS that I am backing up our other servers to on a nightly basis. I'm maintaining between 10-30 days worth of backups depending on the server. Once a week I want to be able to plug in a USB hard-drive and use rsync to backup any files that have been modified in the past week. That hard-drive is then taken offsite.
For the most part I have this working except deleting files on the USB hard-drive that aren't part of the original list. I have to manually delete the files currently on the drive before I start or else I run out of hard-drive space. Could someone take a look at my process to see what might be wrong?
Thanks,
Cory
#mount the usb hard drive
mount -t auto /dev/sde1 /mnt/usb/vol1/
#delete the files on the usb hard drive
#temp fix for rsync --delete not working
rm -rf /mnt/usb/vol1/mnt/*
#create a list of the files modified in the last week
find /mnt/raid5/vol1/server_backups -ctime -7 -type f -print > /backup/modified_files.txt
#rync the files
rsync -avR --delete --files-from=/backup/modified_files.txt / /mnt/usb/vol1/
#unmount the usb hard drive
umount /mnt/usb/vol1/
More information about the Discuss
mailing list