Skip to content

Instantly share code, notes, and snippets.

@ryanzabcik
Last active December 26, 2015 04:39
Show Gist options
  • Save ryanzabcik/7095295 to your computer and use it in GitHub Desktop.
Save ryanzabcik/7095295 to your computer and use it in GitHub Desktop.
This is the backup script designed to run every 6 hours on tachyon.
#!/bin/sh
if [ $EUID != 0 ]; then
echo -e '\e[31mError: this script needs to be run as root'
exit 1
else
rsync -aHAX --delete-during --exclude={/lost+found,/var/lib/docker} /mnt/root/ /mnt/arch-backup
if mount | grep -q /mnt/data0-backup; then
if [ -d /mnt/data0-backup/ToMove ]; then
echo -e '\e[31mWarning: there are files to move from data0-backup/ToMove. This directory will be copied to data0.'
cp -rp /mnt/data0-backup/ToMove /mnt/data0/ToMove
fi
rsync -a --delete-during /mnt/data0/ /mnt/data0-backup
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment