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
771a4759
Commit
771a4759
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
block prune.sh if prune-after = never
parent
86ee8dfd
No related branches found
No related tags found
1 merge request
!125
block prune.sh if prune-after = never
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
transfer.sh
+23
-11
23 additions, 11 deletions
transfer.sh
with
23 additions
and
11 deletions
transfer.sh
+
23
−
11
View file @
771a4759
...
@@ -141,6 +141,7 @@ function _getFileAge(){
...
@@ -141,6 +141,7 @@ function _getFileAge(){
function
setAction
(){
function
setAction
(){
local
action
=
$1
local
action
=
$1
local
myfile
=
$2
local
myfile
=
$2
local
doforce
=
$3
local
iLimit
local
iLimit
iLimit
=
$(
_j_getvar
${
STORAGEFILE
}
"
${
action
}
-after"
)
iLimit
=
$(
_j_getvar
${
STORAGEFILE
}
"
${
action
}
-after"
)
...
@@ -154,16 +155,21 @@ function setAction(){
...
@@ -154,16 +155,21 @@ function setAction(){
echo
"Info:
$action
is ENABLED - no last
$action
detected"
echo
"Info:
$action
is ENABLED - no last
$action
detected"
doValue
=
1
doValue
=
1
else
else
typeset
-i
iLastDone
if
[
"
$doforce
"
-eq
"1"
]
;
then
iLastDone
=
$(
_getFileAge
"
${
myfile
}
"
)
/60
echo
"Force
$action
"
typeset
-i
iLastDoneD
=
iLastDone/60/24
echo
"Info: Last
$action
was
$iLastDone
min ago (
$iLastDoneD
days). Limit is
$iLimit
days."
if
[
$iLastDoneD
-ge
$iLimit
]
;
then
echo
"Info:
$action
is ENABLED - last
$action
is outdated"
doValue
=
1
doValue
=
1
else
else
echo
"Info:
$action
is not needed yet."
typeset
-i
iLastDone
doValue
=
0
iLastDone
=
$(
_getFileAge
"
${
myfile
}
"
)
/60
typeset
-i
iLastDoneD
=
iLastDone/60/24
echo
"Info: Last
$action
was
$iLastDone
min ago (
$iLastDoneD
days). Limit is
$iLimit
days."
if
[
$iLastDoneD
-ge
$iLimit
]
;
then
echo
"Info:
$action
is ENABLED - last
$action
is outdated"
doValue
=
1
else
echo
"Info:
$action
is not needed yet."
doValue
=
0
fi
fi
fi
fi
fi
}
}
...
@@ -193,8 +199,8 @@ function setAction(){
...
@@ -193,8 +199,8 @@ function setAction(){
# set defaults for prune and verify
# set defaults for prune and verify
echo
">>> Detect default behaviour:"
echo
">>> Detect default behaviour:"
setAction
"prune"
"
$lastprunefile
"
;
doPrune
=
$doValue
setAction
"prune"
"
$lastprunefile
"
0
;
doPrune
=
$doValue
setAction
"verify"
"
$lastverifyfile
"
;
doVerify
=
$doValue
setAction
"verify"
"
$lastverifyfile
"
0
;
doVerify
=
$doValue
echo
echo
echo
">>> Check parameters"
echo
">>> Check parameters"
...
@@ -202,7 +208,7 @@ function setAction(){
...
@@ -202,7 +208,7 @@ function setAction(){
echo
"Info: Forcing prune only by parameter."
echo
"Info: Forcing prune only by parameter."
ACTION
=
$1
ACTION
=
$1
doBackup
=
0
doBackup
=
0
doPrune
=
1
setAction
"prune"
"
$lastprunefile
"
1
;
doPrune
=
$doValue
doVerify
=
0
doVerify
=
0
transferlog
=
"
${
DIR_LOGS
}
/prune-
$(
date
+%Y%m%d-%H%M%S
)
.log"
transferlog
=
"
${
DIR_LOGS
}
/prune-
$(
date
+%Y%m%d-%H%M%S
)
.log"
fi
fi
...
@@ -214,6 +220,12 @@ function setAction(){
...
@@ -214,6 +220,12 @@ function setAction(){
doVerify
=
1
doVerify
=
1
transferlog
=
"
${
DIR_LOGS
}
/verify-
$(
date
+%Y%m%d-%H%M%S
)
.log"
transferlog
=
"
${
DIR_LOGS
}
/verify-
$(
date
+%Y%m%d-%H%M%S
)
.log"
fi
fi
if
[
"
${
doBackup
}${
doPrune
}${
doVerify
}
"
=
"000"
]
;
then
echo
"Nothing to do. Aborting."
exit
0
fi
exec
1>
>(
tee
-a
"
$transferlog
"
)
2>&1
exec
1>
>(
tee
-a
"
$transferlog
"
)
2>&1
echo
"INFO: Start logging into
$transferlog
"
echo
"INFO: Start logging into
$transferlog
"
...
...
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