Skip to content
Snippets Groups Projects
Verified Commit 47479a34 authored by David Beniamine's avatar David Beniamine
Browse files

Allow to choose confifile

parent 1936ccd8
Branches
No related tags found
No related merge requests found
#!/bin/bash
DIR=$(realpath $(dirname $0))
if [ ! -z "$1" ]; then
conf_file=$1
shift
fi
source $DIR/inc.sh
exit_on_fail(){
......
#!/bin/bash
DIR=$(realpath $(dirname $0))
if [ ! -z "$1" ]; then
conf_file=$1
shift
fi
source $DIR/inc.sh
export PASSPHRASE="$encpass"
......
#!/bin/bash
DIR=$(realpath $(dirname $0))
source $DIR/.env
if [ -z "$conf_file" ]; then
conf_file="$DIR/.env"
fi
source $conf_file
# Exit the script and sendmail
# $1 : exit code
......
#!/bin/bash
DIR=$(realpath $(dirname $0))
source $DIR/inc.sh
if [ -z "$2" ]; then
echo "Usage $0 <restore_path> <destination_path> [timeago]"
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 "timeago : optionnal : the age of the version we want to restore, for instance 6D for 6 days ago"
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
if [ ! -z "$3" ]; then
delay="-t $3"
fi
source $DIR/inc.sh
export PASSPHRASE="$encpass"
export FTP_PASSWORD="$ftppass"
/usr/bin/duplicity --file-to-restore $delay "$1" ftp://$user@$host/$remotedir/ "$2"
/usr/bin/duplicity --file-to-restore $delay "$restore_path" ftp://$user@$host/$remotedir/ "$destination_path"
unset PASSPHRASE
unset FTP_PASSWORD
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment