Skip to content

Instantly share code, notes, and snippets.

@bcalloway
Created April 2, 2014 17:19
Show Gist options
  • Save bcalloway/9938720 to your computer and use it in GitHub Desktop.
Save bcalloway/9938720 to your computer and use it in GitHub Desktop.
Full system backup that runs once a week
#!/bin/sh
######################################################
# This script executes a full system backup.
#
# A cron job should run this weekly.
# 0 3 * * 0 sh /home/bcalloway/scripts/system_backup.sh > /dev/null
#
# 2014-04-01 Brandon Calloway
######################################################
# initial GoogleDrive sync
grive
DATE=`date +%Y-%m-%d%n`
#first remove the old timestamp file
/bin/rm -f /var/log/usr.snar
#remove the old backups
/bin/rm -f /mnt/GoogleDrive/backups/*
#create the new full backup
/bin/tar -cvpzf /mnt/GoogleDrive/backups/$DATE.full.tar.gz --exclude=/mnt/GoogleDrive --exclude=/home/bcalloway/_backup --listed-incremental=/var/log/usr.snar --one-file-system /
# final GoogleDrive sync
grive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment