diff --git a/backup.sh b/backup.sh index 121aef6c0eb85d92b14d7cb55adb314e1f7160a0..3142cc319acdada74320b309f9bb469aba791756 100755 --- a/backup.sh +++ b/backup.sh @@ -14,6 +14,7 @@ # # 2022-01-14 ah v1.0 # 2022-02-10 ah v1.1 handle local dumps only; improve infos +# 2022-11-04 ah v1.2 rename hooks # ================================================================================ . $( dirname "$0" )/jobhelper.sh @@ -176,7 +177,7 @@ EOFbackupinfo if [ $bStart -eq 1 ]; then - _j_runHooks "10-before-backup" + _j_runHooks "100-before-backup" sleep 3 diff --git a/localdump.sh b/localdump.sh index 36abbfe34e9fe995d54b964ce3633b919482b441..a9f20d1681a6bbc283fde956ecd000fe2b1c339b 100755 --- a/localdump.sh +++ b/localdump.sh @@ -15,6 +15,7 @@ # 2021-07-13 ..... remove leading ./ in localdump.sh restore # 2022-02-18 ..... WIP: use class like functions # 2022-03-17 ..... WIP: add lines with prefix __DB__ +# 2022-11-04 ah rename hooks # ====================================================================== # --- variables: @@ -354,9 +355,9 @@ # ----- start service specific script h2 "START SCRIPT FOR ${SERVICENAME} - $BACKUP_SCRIPT" - _j_runHooks "12-before-db-service" + _j_runHooks "200-before-db-service" . $BACKUP_SCRIPT $mode - _j_runHooks "18-after-db-service" "$rc" + _j_runHooks "230-after-db-service" "$rc" # ----- post jobs: cleanup cleanup_backup_target diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh index ba4d0cce82105efa8f4d0206cc95e11ff14c2156..73035acfad0fc3ab6b8664253e37bca6c4c7c1a4 100644 --- a/plugins/transfer/restic.sh +++ b/plugins/transfer/restic.sh @@ -15,6 +15,7 @@ # 2022-05-10 ah v0.5 fix handling with nocache flag (use globally as default param - not in backup only) # 2022-05-16 ah v0.6 added restic prune # 2022-10-21 ah v0.7 simplify restic exec commands in _restic; remove --prune in check +# 2022-11-04 ah v1.0 one command for forget and prune; rename hooks # ================================================================================ # -------------------------------------------------------------------------------- @@ -177,13 +178,14 @@ # return exitcode of restic prune function t_backupDoPrune(){ # -------------------- - echo "--- FORGET (in all pathes of repository)" + echo "--- FORGET AND PRUNE (in all pathes of repository)" local _tag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag") local _mycmd="forget \ ${ARGS_DEFAULT} \ --tag $_tag \ --group-by paths,tags \ + --prune \ --cleanup-cache" local _keep @@ -201,13 +203,8 @@ t_rcCheckCleanup $_myrc echo - # -------------------- - echo "--- PRUNE (whole repository)" - _restic prune - _myrc=$? - t_rcCheckPrune $_myrc - _j_runHooks "26-after-prune" "$_myrc" + _j_runHooks "330-after-prune" "$_myrc" echo return $_myrc @@ -225,7 +222,7 @@ _myrc=$? t_rcCheckVerify $_myrc - _j_runHooks "28-after-verify" "$_myrc" + _j_runHooks "340-after-verify" "$_myrc" echo return $_myrc } @@ -405,16 +402,6 @@ } # verify backup data # param integer exitcode of command - function t_rcCheckPrune(){ - echo -n "__PRUNE__ " - case $1 in - 0) color ok; echo "OK" ;; - *) color error; echo "FAILED - returncode was $1" ;; - esac - color reset - } - # verify backup data - # param integer exitcode of command function t_rcCheckVerify(){ echo -n "__VERIFY__ " case $1 in diff --git a/transfer.sh b/transfer.sh index ccdd6464d0b8c3d10b40dc377af3524fe5aa279c..5f3ee88476d2c5db31dc51e3fb51c84d8bb8df1e 100755 --- a/transfer.sh +++ b/transfer.sh @@ -35,6 +35,7 @@ # 2022-10-07 ah v2.5 unescape regex with space to prevent "grep: warning: stray \ before white space" # 2022-10-20 ah v2.6 move hook 20-before-transfer (after init of the backup tool) # 2022-10-21 ah v2.7 shell fixes; +# 2022-11-04 ah v2.8 rename hooks # ================================================================================ @@ -313,7 +314,7 @@ function setAction(){ # -------------------------------------------------------------------------------- # ----- PRE transfer - _j_runHooks "20-before-transfer" + _j_runHooks "300-before-transfer" h2 "$( date ) Wait for a free slot" @@ -390,7 +391,7 @@ function setAction(){ echo "SKIP backup" else - _j_runHooks "22-before-folder-transfer" + _j_runHooks "310-before-folder-transfer" sCmd="$( t_backupDirGetCmdBackup )" echo "what: ${BACKUP_DIR}" @@ -404,7 +405,7 @@ function setAction(){ echo t_rcCheckBackup $myrc "${BACKUP_DIR}" - _j_runHooks "24-after-folder-transfer" "$myrc" + _j_runHooks "320-after-folder-transfer" "$myrc" fi echo @@ -496,7 +497,7 @@ function setAction(){ fi color reset - _j_runHooks "30-post-backup" "$rc" + _j_runHooks "400-post-backup" "$rc" echo typeset -i TIMER_TRANSFER TIMER_TRANSFER=$(date +%s)-$TIMER_TRANSFER_START