Skip to content

Instantly share code, notes, and snippets.

@dedeibel
Created September 18, 2014 07:59
Show Gist options
  • Save dedeibel/271ed7dc928c1ea7ef4d to your computer and use it in GitHub Desktop.
Save dedeibel/271ed7dc928c1ea7ef4d to your computer and use it in GitHub Desktop.
create an archive using tar (see also backup 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/archive-${DATE}.log
echo "starting " `date +%Y-%m-%d` | tee -a "$STDOUT"
tar -cvpzf /backup/fullbackup-$DATE.tar.gz --exclude-from=/etc/backup_excludes --exclude-backups --exclude-caches-all / 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