From: Alexander Barton Date: Wed, 1 Jun 2016 09:24:04 +0000 (+0200) Subject: Implement new "backup_type": "disabled" X-Git-Url: https://arthur.barton.de/gitweb/?p=backup-script.git;a=commitdiff_plain;h=26502cec0f7050eff16a5861f0b136917c2b2e22 Implement new "backup_type": "disabled" --- diff --git a/README.md b/README.md index c6602d8..893344c 100644 --- 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 diff --git a/bin/backup-script b/bin/backup-script index 8edf4d1..b2a9b03 100755 --- a/bin/backup-script +++ b/bin/backup-script @@ -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