Last active
December 26, 2015 04:39
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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