Last active
March 11, 2019 21:07
-
-
Save jrh-spg/db351fecac002dbb01cd3de306da4bd1 to your computer and use it in GitHub Desktop.
A simple duplicity backup script
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/bash | |
ulimit -n 10000 | |
PIDFILE=/var/run/backup.pid | |
LOGFILE=/var/log/backup.log | |
if [ -f "$PIDFILE" ]; then | |
RUNPID=`cat $PIDFILE` | |
if ps -p $RUNPID; then | |
echo "Backups are already running..." | |
exit 1 | |
else | |
echo "Backup pid found but the process is dead. Cleaning up..." | |
rm -f $PIDFILE | |
fi | |
else | |
echo "No backup process detected" | |
fi | |
echo $$ > $PIDFILE | |
test -x $(which duplicity) || exit 0 | |
. /root/.passphrase | |
export PASSPHRASE | |
$(which duplicity) --encrypt-key E4C7DC7A628F94E2 --exclude /tmp --exclude /proc --exclude /dev --exclude /sys --exclude /backup --exclude /run --exclude /home/jharris/Videos / file:///backup/duplicity |/usr/bin/tee $LOGFILE | |
echo -n "Backups completed at: " | |
date | |
rm -f $PIDFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment