Skip to content
Snippets Groups Projects
Commit f2787629 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

one command for forget and prune; rename hooks

parent a2dddcf7
Branches
No related tags found
1 merge request!885814 migrate repo to v2 - rename hooks
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
# #
# 2022-01-14 ah v1.0 # 2022-01-14 ah v1.0
# 2022-02-10 ah v1.1 handle local dumps only; improve infos # 2022-02-10 ah v1.1 handle local dumps only; improve infos
# 2022-11-04 ah v1.2 rename hooks
# ================================================================================ # ================================================================================
. $( dirname "$0" )/jobhelper.sh . $( dirname "$0" )/jobhelper.sh
...@@ -176,7 +177,7 @@ EOFbackupinfo ...@@ -176,7 +177,7 @@ EOFbackupinfo
if [ $bStart -eq 1 ]; then if [ $bStart -eq 1 ]; then
_j_runHooks "10-before-backup" _j_runHooks "100-before-backup"
sleep 3 sleep 3
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# 2021-07-13 ..... remove leading ./ in localdump.sh restore # 2021-07-13 ..... remove leading ./ in localdump.sh restore
# 2022-02-18 ..... WIP: use class like functions # 2022-02-18 ..... WIP: use class like functions
# 2022-03-17 ..... WIP: add lines with prefix __DB__ # 2022-03-17 ..... WIP: add lines with prefix __DB__
# 2022-11-04 ah rename hooks
# ====================================================================== # ======================================================================
# --- variables: # --- variables:
...@@ -354,9 +355,9 @@ ...@@ -354,9 +355,9 @@
# ----- start service specific script # ----- start service specific script
h2 "START SCRIPT FOR ${SERVICENAME} - $BACKUP_SCRIPT" h2 "START SCRIPT FOR ${SERVICENAME} - $BACKUP_SCRIPT"
_j_runHooks "12-before-db-service" _j_runHooks "200-before-db-service"
. $BACKUP_SCRIPT $mode . $BACKUP_SCRIPT $mode
_j_runHooks "18-after-db-service" "$rc" _j_runHooks "230-after-db-service" "$rc"
# ----- post jobs: cleanup # ----- post jobs: cleanup
cleanup_backup_target cleanup_backup_target
......
...@@ -15,6 +15,7 @@ ...@@ -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-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-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-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 @@ ...@@ -177,13 +178,14 @@
# return exitcode of restic prune # return exitcode of restic prune
function t_backupDoPrune(){ 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 _tag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag")
local _mycmd="forget \ local _mycmd="forget \
${ARGS_DEFAULT} \ ${ARGS_DEFAULT} \
--tag $_tag \ --tag $_tag \
--group-by paths,tags \ --group-by paths,tags \
--prune \
--cleanup-cache" --cleanup-cache"
local _keep local _keep
...@@ -201,13 +203,8 @@ ...@@ -201,13 +203,8 @@
t_rcCheckCleanup $_myrc t_rcCheckCleanup $_myrc
echo echo
# --------------------
echo "--- PRUNE (whole repository)"
_restic prune
_myrc=$?
t_rcCheckPrune $_myrc _j_runHooks "330-after-prune" "$_myrc"
_j_runHooks "26-after-prune" "$_myrc"
echo echo
return $_myrc return $_myrc
...@@ -225,7 +222,7 @@ ...@@ -225,7 +222,7 @@
_myrc=$? _myrc=$?
t_rcCheckVerify $_myrc t_rcCheckVerify $_myrc
_j_runHooks "28-after-verify" "$_myrc" _j_runHooks "340-after-verify" "$_myrc"
echo echo
return $_myrc return $_myrc
} }
...@@ -405,16 +402,6 @@ ...@@ -405,16 +402,6 @@
} }
# verify backup data # verify backup data
# param integer exitcode of command # 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(){ function t_rcCheckVerify(){
echo -n "__VERIFY__ " echo -n "__VERIFY__ "
case $1 in case $1 in
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
# 2022-10-07 ah v2.5 unescape regex with space to prevent "grep: warning: stray \ before white space" # 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-20 ah v2.6 move hook 20-before-transfer (after init of the backup tool)
# 2022-10-21 ah v2.7 shell fixes; # 2022-10-21 ah v2.7 shell fixes;
# 2022-11-04 ah v2.8 rename hooks
# ================================================================================ # ================================================================================
...@@ -313,7 +314,7 @@ function setAction(){ ...@@ -313,7 +314,7 @@ function setAction(){
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
# ----- PRE transfer # ----- PRE transfer
_j_runHooks "20-before-transfer" _j_runHooks "300-before-transfer"
h2 "$( date ) Wait for a free slot" h2 "$( date ) Wait for a free slot"
...@@ -390,7 +391,7 @@ function setAction(){ ...@@ -390,7 +391,7 @@ function setAction(){
echo "SKIP backup" echo "SKIP backup"
else else
_j_runHooks "22-before-folder-transfer" _j_runHooks "310-before-folder-transfer"
sCmd="$( t_backupDirGetCmdBackup )" sCmd="$( t_backupDirGetCmdBackup )"
echo "what: ${BACKUP_DIR}" echo "what: ${BACKUP_DIR}"
...@@ -404,7 +405,7 @@ function setAction(){ ...@@ -404,7 +405,7 @@ function setAction(){
echo echo
t_rcCheckBackup $myrc "${BACKUP_DIR}" t_rcCheckBackup $myrc "${BACKUP_DIR}"
_j_runHooks "24-after-folder-transfer" "$myrc" _j_runHooks "320-after-folder-transfer" "$myrc"
fi fi
echo echo
...@@ -496,7 +497,7 @@ function setAction(){ ...@@ -496,7 +497,7 @@ function setAction(){
fi fi
color reset color reset
_j_runHooks "30-post-backup" "$rc" _j_runHooks "400-post-backup" "$rc"
echo echo
typeset -i TIMER_TRANSFER typeset -i TIMER_TRANSFER
TIMER_TRANSFER=$(date +%s)-$TIMER_TRANSFER_START TIMER_TRANSFER=$(date +%s)-$TIMER_TRANSFER_START
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment