Backup script (was Re: rsync problem)
sammy ominsky
s at avoidant.org
Tue Mar 22 03:34:13 IST 2011
On 21/03/2011, at 15:57, Omer Zak wrote:
> By the way, my own backup script uses the following rsync flags:
> rsync -avH --progress --max-delete=200000 --delete --delete-excluded
> --exclude-from=$EXCLUSIONS_FILE $FROM $TO
This looks like a fun game! I'll show you mine if you'll show me yours.
#!/bin/bash
date=`date "+%Y-%m-%d"`
mkdir /nas/web-backup/Backups/${date}-incomplete
rsync -avP --exclude-from=/etc/rsync/web-exclude --link-dest=/nas/web-backup/Backups/current /nas/web/ /nas/web-backup/Backups/${date}-incomplete
mv /nas/web-backup/Backups/${date}-incomplete /nas/web-backup/Backups/${date}
chown -R www-data:www-data /nas/web-backup/Backups/${date}
cd /nas/web-backup/Backups
rm /nas/web-backup/Backups/current
ln -s ${date} current
unset date
# delete backups created more than 7 days ago
find /nas/web-backup/Backups/ -maxdepth 1 -ctime +6 -exec rm -rf {} \;
--sambo
More information about the Linux-il
mailing list