X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=bin%2Fbackup-script;h=9530410dee0e8d85b7e7b18ad9cefdba4d6cc00f;hb=05cbdc409dd5e4ef1c1d32dcaf15c6baa77e865d;hp=a235190c3038a67f6941965e1099ee98443cfc24;hpb=8c3a0b5d4fcd67eef6c601d7a012a10de489c32b;p=backup-script.git diff --git a/bin/backup-script b/bin/backup-script index a235190..9530410 100755 --- a/bin/backup-script +++ b/bin/backup-script @@ -16,6 +16,7 @@ PIDFILE="/var/run/$NAME.pid" DRYRUN=0 VERBOSE=0 TAG="" +PREPOSTEXEC=1 export LC_ALL=C @@ -53,13 +54,14 @@ default_job_post_exec="" default_tags="" Usage() { - echo "Usage: $NAME [] [ [ [...]]]" + echo "Usage: $NAME [] [ [ [...]]]" echo echo " -n, --dry-run Test run only, don't copy any data." echo " -p, --progress Show progress, see rsync(1)." echo " -t TAG, --tag TAG Only run jobs with tag TAG." + echo " -x, --no-exec Don't run global pre-/post-exec commands." echo - echo "When no is given, all defined systems are used." + echo "When no is given, all defined systems are used." echo # shellcheck disable=SC2086 echo -e $config_info @@ -68,7 +70,7 @@ Usage() { } CleanUp() { - if [ -n "$post_exec" ]; then + if [[ -n "$pre_exec" && $PREPOSTEXEC -ne 0 ]]; then echo "Executing \"$post_exec\" ..." sh -c $post_exec if [ $? -ne 0 ]; then @@ -305,6 +307,9 @@ while [ $# -gt 0 ]; do shift; TAG="$1"; shift [ -n "$TAG" ] || Usage ;; + "-x"|"--no-exec") + PREPOSTEXEC=0; shift + ;; "-"*) Usage ;; @@ -344,7 +349,7 @@ else sys=("${conf_d}/"*) fi -if [ -n "$setup_exec" ]; then +if [[ -n "$setup_exec" && $PREPOSTEXEC -ne 0 ]]; then echo "Executing \"$setup_exec\" ..." sh -c $setup_exec if [ $? -ne 0 ]; then @@ -375,7 +380,7 @@ else echo "$$" >>"$PIDFILE" fi -if [ -n "$pre_exec" ]; then +if [[ -n "$pre_exec" && $PREPOSTEXEC -ne 0 ]]; then echo "Executing \"$pre_exec\" ..." sh -c $pre_exec if [ $? -ne 0 ]; then