Skip to content

Instantly share code, notes, and snippets.

@huettern
Created February 9, 2018 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huettern/176829671c480c4f402a69e500cb5116 to your computer and use it in GitHub Desktop.
Save huettern/176829671c480c4f402a69e500cb5116 to your computer and use it in GitHub Desktop.
#!/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