Skip to content

Instantly share code, notes, and snippets.

@dedeibel
Created September 18, 2014 07:57
Show Gist options
  • Save dedeibel/9b3587b6e809f692cdda to your computer and use it in GitHub Desktop.
Save dedeibel/9b3587b6e809f692cdda to your computer and use it in GitHub Desktop.
run backup using rsync (see also archive and withbackupdevice)
#!/bin/bash
set -e
cd /
if [ ! -f /backup/ready ]; then
echo "backup device not ready"
exit
fi
DATE=`date +%Y-%m-%d`
STDOUT=/var/log/backup-${DATE}.log
echo "starting " `date +%Y-%m-%d` | tee -a "$STDOUT"
# -n - preview
rsync -u -aAXv --delete --delete-excluded --exclude-from=/etc/backup_excludes /* /backup/current 2>&1 | tee -a "$STDOUT"
echo "done " `date +%Y-%m-%d` | tee -a "$STDOUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment