Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Iml Backup Server
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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 Server
Compare revisions
f370bb43f6c6f6394f011c0611bcb1c41be892f9 to 70055581d70bbe61e9815597bae9998945289a88
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
iml-open-source/iml-backup-server
Select target project
No results found
70055581d70bbe61e9815597bae9998945289a88
Select Git revision
Swap
Target
iml-open-source/iml-backup-server
Select target project
iml-open-source/iml-backup-server
1 result
f370bb43f6c6f6394f011c0611bcb1c41be892f9
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
update status
· 55f2cd73
Hahn Axel (hahn)
authored
1 year ago
55f2cd73
update docs
· 8f7348b1
Hahn Axel (hahn)
authored
1 year ago
8f7348b1
Merge branch 'add_prune_script' into 'master'
· 70055581
Hahn Axel (hahn)
authored
1 year ago
Add prune script See merge request
!6
70055581
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/30_Scripts.md
+2
-2
2 additions, 2 deletions
docs/30_Scripts.md
rest_pruner.sh
+22
-9
22 additions, 9 deletions
rest_pruner.sh
with
24 additions
and
11 deletions
docs/30_Scripts.md
View file @
70055581
...
...
@@ -137,7 +137,7 @@ The inc_config.sh mus contain 3 variables for pruning
```
bash
# for prune on restic rest server
prune_basedir
=
/netshare/restic-backup
prune_params
=
"--group-by paths,tags --prune --keep-within 180d --max-unused unlimited --max-repack-size 10
0M
--cleanup-cache"
prune_params
=
"--group-by paths,tags --prune --keep-within 180d --max-unused unlimited --max-repack-size 10
G
--cleanup-cache"
prune_skipdays
=
"7"
prune_cachedir
=
${
prune_basedir
}
/.cache_for_pruning
```
...
...
@@ -164,7 +164,7 @@ ls -l rest_pruner.cfg
```txt
------------------------------------------------------------------------------
--------========###| RESTIC REST PRUNER :: v0.
3
|###=======--------
--------========###| RESTIC REST PRUNER :: v0.
4
|###=======--------
------------------------------------------------------------------------------
Pruner for restic rest server with append only option.
...
...
This diff is collapsed.
Click to expand it.
rest_pruner.sh
View file @
70055581
...
...
@@ -7,11 +7,12 @@
# 2024-02-01 v0.1 <axel.hahn@unibe.ch> first lines
# 2024-02-02 v0.2 <axel.hahn@unibe.ch> add: timer, skip file, skin N days, limit process time, stats
# 2024-02-03 v0.3 <axel.hahn@unibe.ch> enable cache dir; unlock before pruning
# 2024-02-14 v0.4 <axel.hahn@unibe.ch> update status
# ======================================================================
cd
"
$(
dirname
$0
)
"
||
exit
_version
=
0.
3
_version
=
0.
4
logdir
=
_last_prune
prune_basedir
=
...
...
@@ -181,6 +182,9 @@ function _prune(){
if
[
"
$rc
"
-eq
"0"
]
;
then
mv
"
${
logfile
}
.running"
"
${
logfile
}
"
iCountPrune+
=
1
# remove last error file if run was ok now
test
-f
"
${
logfile
}
.error"
&&
rm
-f
"
${
logfile
}
.error"
else
iCountPruneError+
=
1
mv
"
${
logfile
}
.running"
"
${
logfile
}
.error"
...
...
@@ -206,7 +210,7 @@ function _status(){
_processes
=
"
$(
ps
-eo
command
)
"
echo
"Prune status:"
for
_dir
in
$(
find
${
prune_basedir
}
-maxdepth
1
-type
d |
grep
-E
"
$filter
"
)
for
_dir
in
$(
find
${
prune_basedir
}
-maxdepth
1
-type
d |
grep
-E
"
$filter
"
|
sort
)
do
local
mybase
;
mybase
=
$(
basename
"
${
_dir
}
"
)
local
mypw
;
mypw
=
$(
grep
"^
${
mybase
}
:"
"
${
cfgfile
}
"
|
cut
-f2
-d
':'
)
...
...
@@ -218,30 +222,38 @@ function _status(){
local
_flagRunning
=
"."
local
_flagError
=
"."
local
_sLastPrune
=
"?"
local
_iAge
local
_iDays
iCountDirs+
=
1
test
-n
"
$mypw
"
&&
_flagPw
=
"Y"
grep
"
\.
"
<<<
"
$mybase
"
>
/dev/null
&&
_flagPw
=
"."
test
-f
"
$_dir
/
${
sSkipfile
}
"
&&
_flagArchive
=
"A"
test
-f
"
${
logfile
}
.error"
&&
_flagError
=
"E"
test
-f
"
${
logfile
}
.error"
&&
iCountPruneError+
=
1
grep
"restic forget.*
${
_dir
}
"
<<<
"
$_processes
"
|
grep
-v
"grep"
|
grep
.
>
/dev/null
&&
_flagRunning
=
"R"
if
[
-f
"
${
logfile
}
"
]
;
then
local
_iAge
;
_iAge
=
$(
_getFileAge
"
${
logfile
}
"
)
local
_iDays
;
typeset
-i
_iDays
=
$((
_iAge/60/60/24
))
_sLastPrune
=
"
$_iDays
days ago"
_iAge
=
$(
_getFileAge
"
${
logfile
}
"
)
typeset
-i
_iDays
=
$((
_iAge/60/60/24
))
_sLastPrune
=
"
$_iDays
d ago"
test
"
$_iDays
"
-eq
"0"
&&
_sLastPrune
=
"today"
fi
if
[
-n
"
$mypw
"
]
||
[
"
$_flagArchive
"
=
"A"
]
||
[
"
$bOptAll
"
-eq
"1"
]
;
then
iCountMatch+
=
1
printf
"%1s %1s %1s %1s %-
12
s %s
\n
"
"
$_flagPw
"
"
$_flagArchive
"
"
$_flagError
"
"
$_flagRunning
"
"
$_sLastPrune
"
"
$_dir
"
printf
"%1s %1s %1s %1s %-
9
s %s
\n
"
"
$_flagPw
"
"
$_flagArchive
"
"
$_flagError
"
"
$_flagRunning
"
"
$_sLastPrune
"
"
$_dir
"
fi
done
if
[
"
$iCountMatch
"
-gt
"0"
]
;
then
echo
echo
": : : : :
:"
echo
": : : : :
+-- repository dir"
echo
": : : : : :"
echo
": : : : : +-- repository dir"
echo
": : : : +-- last successful prune"
echo
": : : +-- is it currently running?"
echo
": : +-- Last prune on error?"
...
...
@@ -251,6 +263,7 @@ function _status(){
echo
"INFO: No (matching) Repository was found."
fi
echo
}
# ----------------------------------------------------------------------
# MAIN
...
...
@@ -367,7 +380,7 @@ do
_prune
"
${
mydir
}
"
done
test
"
$bOptStats
"
-eq
"0"
&&
cat
<<
ENDSTATS
cat
<<
ENDSTATS
Statistics:
...
...
This diff is collapsed.
Click to expand it.