Adding ability to remove backup logs over 7 days old

This commit is contained in:
Tracey Clark 2019-01-04 18:18:00 -06:00
commit 7bcec44bb8

View file

@ -27,10 +27,12 @@ fi
echo "Preparing to transfer differences in home directory to backup USB drive using rsync." echo "Preparing to transfer differences in home directory to backup USB drive using rsync."
rsync -avzh --exclude '.cache' --exclude 'Videos' --exclude 'Nextloud' --exclude 'Downloads/isos' --exclude 'VirtualBox VMs' --exclude 'Sync' --exclude 'Downloads/torrents' --exclude '.local/share/Steam' --exclude 'Music' --progress --delete /home/tracey/Documents /media/tracey/Backup/tracey/Documents/ 2>&1 | tee $log_file rsync -avzh --exclude '.cache' --exclude 'Videos' --exclude 'Nextloud' --exclude 'Downloads/isos' --exclude 'VirtualBox VMs' --exclude 'Sync' --exclude 'Downloads/torrents' --exclude '.local/share/Steam' --exclude 'Music' --progress --delete /home/tracey/ /media/tracey/Backup/tracey/ 2>&1 | tee $log_file
echo "" echo ""
echo "Backup Complete" echo "Backup Complete"
echo "Log of this backup is in $log_file" echo "Log of this backup is in $log_file"
echo "" echo "Now deleting backup logs over 7 days"
echo "####" echo "####"
find /home/tracey -iname 'usb-rsync-backup-*' -mtime +7 -exec rm {} \;