]> arthur.barton.de Git - backup-script.git/commitdiff
Implement new "backup_type": "disabled"
authorAlexander Barton <alex@barton.de>
Wed, 1 Jun 2016 09:24:04 +0000 (11:24 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 1 Jun 2016 09:24:04 +0000 (11:24 +0200)
README.md
bin/backup-script

index c6602d818e80eec8bc4549b88a1fccefaed1b018..893344cfbf5c3d43dc3525a4e33a6fd4e6c87278 100644 (file)
--- a/README.md
+++ b/README.md
@@ -83,6 +83,9 @@ Backup type to use. Default: `rsync`.
 - `scp`: file backup using scp(1).
   Use `files` to specify the files to copy.
 
+- `disabled`: job is disabled and will not be run. This becomes accounted as
+  "success" in the summary and exit code of the backup script.
+
 Please note that neither `ssh_args_add`, `rsync_args_add`, `compress`, nor any
 "exclude" parameters are supported when using the "scp" backup type! And There
 "scp" backup type never _deletes_ files from the backup store; so if you reduce
index 8edf4d1122bdd2b9cffe7ee1580fee0a0724d187..b2a9b033751984ddaaf8e7e48a7fd6902d665c4f 100755 (executable)
@@ -23,6 +23,7 @@ declare -i count_all=0
 declare -i count_started=0
 declare -i count_ok=0
 declare -i count_ok_vanished=0
+declare -i count_enabled=0
 
 destinations=""
 
@@ -477,6 +478,14 @@ for f in "${sys[@]}"; do
 
        count_all=$count_all+1
 
+       # Check if job is disabled
+       if [ "$backup_type" = "disabled" ]; then
+               echo "Job is DISABLED and will be skipped."
+               echo; continue
+       fi
+
+       count_enabled=$count_enabled+1
+
        # Check target directory
        if [ -z "$target" ]; then
                echo "No target directory specified for \"$system\"!? Skipped!"
@@ -738,7 +747,9 @@ CleanUp
 echo -n "Done: "; date
 echo
 [ $count_all -eq 1 ] && s="" || s="s"
-echo " - $count_all job$s defined,"
+[ $count_enabled -eq $count_all ] \
+       && echo " - $count_all job$s defined (all enabled)," \
+       || echo " - $count_all job$s defined ($count_enabled enabled),"
 [ $count_started -eq 1 ] && s="" || s="s"
 echo " - $count_started job$s started,"
 echo " - $count_ok done without errors."
@@ -748,7 +759,7 @@ if [ $count_started -ne $count_ok ]; then
        echo "----->  THERE HAVE BEEN ERRORS!  <-----"
        echo
        exit 6
-elif [ $count_all -ne $count_started ]; then
+elif [ $count_enabled -ne $count_started ]; then
        exit 7
 fi