#!/bin/bash DIR=$(realpath $(dirname $0)) usage(){ echo "Usage $0 [options] <restore_path> <destination_path>" echo "restore_path : path to restore without leading slash" echo "destination_path : path to download the file(s), duplicity will not override existing files" echo "options" echo " -t timeago : the age of the version we want to restore, for instance 6D for 6 days ago" echo " -c file : config_file to use" } while getopts "t:c:h" arg; do case ${arg} in h) usage exit 0 ;; t) delay="-t $OPTARG" ;; c) conf_file=$OPTARG ;; esac done restore_path=${@:$OPTIND:1} destination_path=${@:$OPTIND+1:1} if [ -z "$destination_path" ]; then usage exit 1 fi source $DIR/inc.sh export PASSPHRASE="$encpass" export FTP_PASSWORD="$ftppass" set -x /usr/bin/duplicity --verbosity $verbosity $delay --file-to-restore "$restore_path" $remote "$destination_path" set +x unset PASSPHRASE unset FTP_PASSWORD