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

fixup

parent 040010a5
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ if [ ! -z "$1" ]; then ...@@ -6,6 +6,7 @@ if [ ! -z "$1" ]; then
shift shift
fi fi
source $DIR/inc.sh source $DIR/inc.sh
exec &> >(tee -a "$log_file")
exit_on_fail(){ exit_on_fail(){
[ $1 -ne 0 ] && leave $@ [ $1 -ne 0 ] && leave $@
...@@ -37,8 +38,8 @@ backup(){ ...@@ -37,8 +38,8 @@ backup(){
echo "Creating encrypted incremental backup: $bckplist " echo "Creating encrypted incremental backup: $bckplist "
run_duplicity --full-if-older-than $BK_FULL_FREQ \ run_duplicity --full-if-older-than $BK_FULL_FREQ \
--include ${bckplist// / --include } \ --include ${bckplist// / --include } \
--exclude /root/.cache/duplicity/ --exclude /root/.cache/duplicity/ \
--exclude '**' /
ret=$? ret=$?
if [ -z "$retries" ] if [ -z "$retries" ]
then then
......
#!/bin/bash #!/bin/bash
if [ `whoami` != "root" ]; then
echo "this script must be run as root"
exit 1
fi
DIR=$(realpath $(dirname $0)) DIR=$(realpath $(dirname $0))
if [ -z "$conf_file" ]; then if [ -z "$conf_file" ]; then
conf_file="$DIR/.env" conf_file="$DIR/.env"
...@@ -10,10 +15,12 @@ if [ -z "$log_file" ]; then ...@@ -10,10 +15,12 @@ if [ -z "$log_file" ]; then
log_file=/var/log/bckp.log log_file=/var/log/bckp.log
fi fi
exec &> >(tee -a "$logfile")
if [ -z "$verbosity" ]; then if [ -z "$verbosity" ]; then
verbosity="notice" verbosity="notice"
fi
remote="ftp://$user@$host/$remotedir/"
# Exit the script and sendmail # Exit the script and sendmail
# $1 : exit code # $1 : exit code
...@@ -44,11 +51,11 @@ EOF ...@@ -44,11 +51,11 @@ EOF
run_duplicity(){ run_duplicity(){
export PASSPHRASE="$encpass" export PASSPHRASE="$encpass"
export FTP_PASSWORD="$ftppass" export FTP_PASSWORD="$ftppass"
#set -x set -x
/usr/bin/duplicity --archive-dir /root/.cache/duplicity/$archive_dir --verbosity $verbosity \ /usr/bin/duplicity --verbosity $verbosity \
$@ \ $@ \
$remote $remote
#set +x set +x
unset PASSPHRASE unset PASSPHRASE
unset FTP_PASSWORD unset FTP_PASSWORD
} }
...@@ -69,9 +76,3 @@ collection_state() { ...@@ -69,9 +76,3 @@ collection_state() {
echo "Backups state" echo "Backups state"
run_duplicity collection-status run_duplicity collection-status
} }
if [ `whoami` != "root" ]
then
echo "this script must be run as root"
exit 1
fi
...@@ -36,7 +36,7 @@ source $DIR/inc.sh ...@@ -36,7 +36,7 @@ source $DIR/inc.sh
export PASSPHRASE="$encpass" export PASSPHRASE="$encpass"
export FTP_PASSWORD="$ftppass" export FTP_PASSWORD="$ftppass"
/usr/bin/duplicity --archive-dir $archive_dir --verbosity $verbosity --file-to-restore $delay "$restore_path" ftp://$user@$host/$remotedir/ "$destination_path" /usr/bin/duplicity --verbosity $verbosity --file-to-restore $delay "$restore_path" $remote "$destination_path"
unset PASSPHRASE unset PASSPHRASE
unset FTP_PASSWORD unset FTP_PASSWORD
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment