Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Commits
f2787629
Commit
f2787629
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
one command for forget and prune; rename hooks
parent
a2dddcf7
Branches
Branches containing commit
No related tags found
1 merge request
!88
5814 migrate repo to v2 - rename hooks
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
backup.sh
+2
-1
2 additions, 1 deletion
backup.sh
localdump.sh
+3
-2
3 additions, 2 deletions
localdump.sh
plugins/transfer/restic.sh
+5
-18
5 additions, 18 deletions
plugins/transfer/restic.sh
transfer.sh
+5
-4
5 additions, 4 deletions
transfer.sh
with
15 additions
and
25 deletions
backup.sh
+
2
−
1
View file @
f2787629
...
@@ -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
"10
0
-before-backup"
sleep
3
sleep
3
...
...
This diff is collapsed.
Click to expand it.
localdump.sh
+
3
−
2
View file @
f2787629
...
@@ -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
"
1
2-before-db-service"
_j_runHooks
"2
00
-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
...
...
This diff is collapsed.
Click to expand it.
plugins/transfer/restic.sh
+
5
−
18
View file @
f2787629
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
transfer.sh
+
5
−
4
View file @
f2787629
...
@@ -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
"
2
0-before-transfer"
_j_runHooks
"
30
0-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
"
3
0-post-backup"
"
$rc
"
_j_runHooks
"
40
0-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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment