Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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