Created
February 9, 2018 11:34
-
-
Save huettern/176829671c480c4f402a69e500cb5116 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# GPG Key to use for data encryption | |
KEY_ID=3387FFED | |
# Host | |
HOST=`cat /var/services/homes/outpost/outpost_ip.txt` | |
USER=pi | |
if [ $# -ne 2 ] | |
then | |
echo "Not enough input arguments" | |
echo "Usage: ./outpost_backup.sh SOURCE DESTINATION" | |
exit -1 | |
fi | |
SOURCE=$1 | |
DESTINATION=$HOSTNAME/$2 | |
# Other settings | |
ARCHIVE_DIR=/var/services/homes/$USER/scripts/outpost/archive/ | |
TEMP_DIR=/var/services/homes/$USER/scripts/outpost/tmp/ | |
# Backup command | |
# duplicity --verbosity 4 --gpg-binary=/usr/local/gnupg/bin/gpg2 --encrypt-key $KEY_ID list-current-files rsync://$USER@$HOST/$DESTINATION | |
# Make sure destination exists (HOST is of form ip.ip.ip.ip:port) | |
ssh $USER@${HOST/:/" -p"} "mkdir -p $DESTINATION" | |
duplicity --asynchronous-upload --verbosity 5 --gpg-binary=/usr/local/gnupg/bin/gpg2 --archive-dir=$ARCHIVE_DIR --tempdir=$TEMP_DIR --encrypt-key $KEY_ID $SOURCE rsync://$USER@$HOST/$DESTINATION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment