Backup FileServer

Main Command

  • tar -czpf /mnt/a/full-backup-`date ‘+%d-%B-%Y’`.tgz –directory / –exclude=video –exclude=temp –exclude=stuff –exclude=music –exclude=proc –exclude=mnt –exclude=archive –exclude=cache –exclude=*/lost+found .

To restore

  • tar xpf /dev/st0/full-backup-Day-Month-Year.tar

I have now improved this with a new version of the script…

if [ $(ls -t -r -1 /temp/OSBackups/* | wc -l) -gt 4 ]; then
echo “Weekly Backup – Removing file `ls -t -r -1 /temp/OSBackups/* | head –lines 1`” >> /root/SystemBackup.log
ls -t -r -1 /temp/OSBackups/* | head –lines 1 | xargs rm
echo “Weekly Backup Started: $(date)” >> /root/SystemBackup.log
tar -czpf /temp/OSBackups/full-backup-`date ‘+%d-%B-%Y’`.tgz –directory / –exclude=dev –exclude=proc –exclude=mnt –exclude=sys –exclude=tmp –exclude=var/tmp/ccache –exclude=*/lost+found –exclude=video –exclude=temp –exclude=stuff –exclude=music –exclude=media .
echo “Weekly Backup Complete: $(date)” >> /root/SystemBackup.log

, ,

Leave a Reply

Your email address will not be published.