From 38aa64cd4bb17207f8b3a19ca9d9aaebe202e7fd Mon Sep 17 00:00:00 2001
From: David Beniamine <david.beniamine@tetras-libre.fr>
Date: Mon, 30 Aug 2021 13:23:51 +0200
Subject: [PATCH] Set default timeout to 60 seconds

---
 .env.sample | 1 +
 backup.sh   | 1 +
 inc.sh      | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/.env.sample b/.env.sample
index 58db1d0..b32055c 100644
--- a/.env.sample
+++ b/.env.sample
@@ -9,6 +9,7 @@ verbosity="info"
 # Set an arcihve directory, subdir of /root/.cache/duplicity
 archive_dir=""
 log_file=/var/log/bckp.log
+timeout=60
 
 
 BK_FULL_FREQ="3W" # create a new full backup every...
diff --git a/backup.sh b/backup.sh
index 060f447..3fbbd13 100755
--- a/backup.sh
+++ b/backup.sh
@@ -46,6 +46,7 @@ backup(){
     export FTP_PASSWORD="$ftppass"
     set -x
     /usr/bin/duplicity --verbosity $verbosity \
+        --timeout $timeout \
         --full-if-older-than $BK_FULL_FREQ \
         --include ${bckplist// / --include } \
         --exclude /root/.cache/duplicity/ \
diff --git a/inc.sh b/inc.sh
index b036d2c..9d40257 100755
--- a/inc.sh
+++ b/inc.sh
@@ -20,6 +20,10 @@ if [ -z "$verbosity" ]; then
     verbosity="notice"
 fi
 
+if [ -z "$timeout" ]; then
+    timeout=60
+fi
+
 remote="ftp://$user@$host/$remotedir/"
 
 # Exit the script and sendmail
@@ -53,6 +57,7 @@ run_duplicity(){
     export FTP_PASSWORD="$ftppass"
     set -x
     /usr/bin/duplicity --verbosity $verbosity \
+        --timeout $timeout \
         $@ \
         $remote
     set +x
-- 
GitLab