]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-script
Implement global "setup_exec" configuration option
[backup-script.git] / bin / backup-script
index b2a9b033751984ddaaf8e7e48a7fd6902d665c4f..04572682d78832f7acde423f8b8013f41e7deedd 100755 (executable)
@@ -31,6 +31,7 @@ destinations=""
 [ -d "/usr/local/etc/backup-script.d" ] \
        && conf_d="/usr/local/etc/backup-script.d" \
        || conf_d="/etc/backup-script.d"
+setup_exec=""
 pre_exec=""
 post_exec=""
 default_backup_type="rsync"
@@ -343,6 +344,19 @@ else
        sys=("${conf_d}/"*)
 fi
 
+if [ -n "$setup_exec" ]; then
+       echo "Executing \"$setup_exec\" ..."
+       sh -c $setup_exec
+       if [ $? -ne 0 ]; then
+               echo "Error: setup command failed!"; echo
+               CleanUp
+               echo "Aborting backup."; echo
+               exit 5
+       fi
+       sleep 2
+       echo
+fi
+
 # check and create PID file
 if [ -e "$PIDFILE" ]; then
        echo "Lockfile \"$PIDFILE\" already exists."