]> arthur.barton.de Git - backup-script.git/commitdiff
Don't clean up when "setup_exec" command failed
authorAlexander Barton <alex@barton.de>
Wed, 6 Jul 2016 14:33:20 +0000 (16:33 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 6 Jul 2016 14:33:20 +0000 (16:33 +0200)
bin/backup-script

index 04572682d78832f7acde423f8b8013f41e7deedd..fdd642719cc68e062e8a55c86fbfcde35c002701 100755 (executable)
@@ -330,8 +330,6 @@ echo "Rsync command is $rsync, protocol version $rsync_proto."
 [[ -n "$TAG" ]] && echo "Running jobs tagged with \"$TAG\"."
 echo
 
-trap GotSignal SIGINT
-
 if [ $# -ge 1 ]; then
        for s in "$@"; do
                if [ ! -r "${conf_d}/$s" ]; then
@@ -349,7 +347,6 @@ if [ -n "$setup_exec" ]; then
        sh -c $setup_exec
        if [ $? -ne 0 ]; then
                echo "Error: setup command failed!"; echo
-               CleanUp
                echo "Aborting backup."; echo
                exit 5
        fi
@@ -357,6 +354,8 @@ if [ -n "$setup_exec" ]; then
        echo
 fi
 
+trap GotSignal SIGINT
+
 # check and create PID file
 if [ -e "$PIDFILE" ]; then
        echo "Lockfile \"$PIDFILE\" already exists."