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
Commits
c7129360
Commit
c7129360
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
enable cache dir; unlock before pruning
parent
d49be457
Loading
Loading
1 merge request
!5
update docs
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/30_Scripts.md
+1
-0
1 addition, 0 deletions
docs/30_Scripts.md
inc_config.sh.dist
+3
-1
3 additions, 1 deletion
inc_config.sh.dist
rest_pruner.sh
+21
-4
21 additions, 4 deletions
rest_pruner.sh
with
25 additions
and
5 deletions
docs/30_Scripts.md
+
1
−
0
View file @
c7129360
...
@@ -139,6 +139,7 @@ The inc_config.sh mus contain 3 variables for pruning
...
@@ -139,6 +139,7 @@ The inc_config.sh mus contain 3 variables for pruning
prune_basedir
=
/netshare/restic-backup
prune_basedir
=
/netshare/restic-backup
prune_params
=
"--group-by paths,tags --prune --keep-within 180d --max-unused unlimited --max-repack-size 100M --cleanup-cache"
prune_params
=
"--group-by paths,tags --prune --keep-within 180d --max-unused unlimited --max-repack-size 100M --cleanup-cache"
prune_skipdays
=
"7"
prune_skipdays
=
"7"
prune_cachedir
=
${
prune_basedir
}
/.cache_for_pruning
```
```
## rest_pruner.cfg
## rest_pruner.cfg
...
...
This diff is collapsed.
Click to expand it.
inc_config.sh.dist
+
3
−
1
View file @
c7129360
...
@@ -28,7 +28,9 @@
...
@@ -28,7 +28,9 @@
sLogfile="$sLogdir/connections.log"
sLogfile="$sLogdir/connections.log"
# for prune on restic rest server
# for prune on restic rest server
prune_params="--group-by paths,tags --prune --keep-within 180d --max-unused unlimited --max-repack-size 100M --cleanup-cache"
prune_basedir=/netshare/restic-backup
prune_params="--group-by paths,tags --prune --keep-within 180d --max-unused unlimited --max-repack-size 100M --cleanup-cache --verbose=0"
prune_skipdays="7"
prune_skipdays="7"
prune_cachedir=${prune_basedir}/.cache_for_pruning
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
rest_pruner.sh
+
21
−
4
View file @
c7129360
...
@@ -6,16 +6,18 @@
...
@@ -6,16 +6,18 @@
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# 2024-02-01 v0.1 <axel.hahn@unibe.ch> first lines
# 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-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
# ======================================================================
# ======================================================================
cd
"
$(
dirname
$0
)
"
||
exit
cd
"
$(
dirname
$0
)
"
||
exit
_version
=
0.
2
_version
=
0.
3
logdir
=
_last_prune
logdir
=
_last_prune
prune_basedir
=
prune_basedir
=
prune_params
=
prune_params
=
prune_skipdays
=
7
prune_skipdays
=
7
prune_cachedir
=
# stop pruning more repositories when running longer N seconds
# stop pruning more repositories when running longer N seconds
prune_timeout
=
7200
prune_timeout
=
7200
...
@@ -40,6 +42,7 @@ typeset -i rcAll=0
...
@@ -40,6 +42,7 @@ typeset -i rcAll=0
.
"inc_config.sh"
||
exit
1
.
"inc_config.sh"
||
exit
1
cfgfile
=
rest_pruner.cfg
||
exit
1
cfgfile
=
rest_pruner.cfg
||
exit
1
test
-z
"
$prune_cachedir
"
&&
prune_cachedir
=
"
${
prune_basedir
}
/.cache_for_pruning"
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -153,13 +156,24 @@ function _prune(){
...
@@ -153,13 +156,24 @@ function _prune(){
fi
fi
if
[
"
$bDoRun
"
-eq
"1"
]
;
then
if
[
"
$bDoRun
"
-eq
"1"
]
;
then
local
_user
;
_user
=
$(
stat
-c
"%U"
"
$_dir
"
)
echo
">>>>>
$(
_getTimer
)
sec >>>>>
$_dir
"
echo
">>>>>
$(
_getTimer
)
>>>>>
$_dir
"
local
_user
;
_user
=
$(
stat
-c
"%U"
"
$_dir
"
)
local
_cachedir
;
export
_cachedir
=
$prune_cachedir
/
${
mybase
}
echo
"Creating cache
$_cachedir
..."
test
-d
"
$_cachedir
"
||
mkdir
-p
"
$_cachedir
"
chown
${
_user
}
:
${
_user
}
"
$_cachedir
"
echo
"Starting prune as user
$_user
..."
echo
"Starting prune as user
$_user
..."
su -
$_user
- /bin/bash
-c
"
su -
$_user
- /bin/bash
-c
"
echo START
$(
date
)
$_dir
echo START
$(
date
)
$_dir
export RESTIC_PASSWORD=
$mypw
export RESTIC_PASSWORD=
$mypw
restic forget -r
$_dir
$prune_params
2>&1
set -vx
restic unlock -r
$_dir
--cache-dir=
$_cachedir
2>&1
restic forget -r
$_dir
--cache-dir=
$_cachedir
$prune_params
2>&1
"
|
tee
"
${
logfile
}
.running"
"
|
tee
"
${
logfile
}
.running"
rc
=
${
PIPESTATUS
[0]
}
rc
=
${
PIPESTATUS
[0]
}
rcAll+
=
$rc
rcAll+
=
$rc
...
@@ -170,7 +184,10 @@ function _prune(){
...
@@ -170,7 +184,10 @@ function _prune(){
else
else
iCountPruneError+
=
1
iCountPruneError+
=
1
mv
"
${
logfile
}
.running"
"
${
logfile
}
.error"
mv
"
${
logfile
}
.running"
"
${
logfile
}
.error"
echo
"!!! ERROR !!! pruning failed."
fi
fi
echo
"Removing cache
$_cachedir
..."
rm
-rf
"
$_cachedir
"
fi
fi
else
else
test
"
$bOptAll
"
-eq
"1"
&&
echo
"SKIP:
$_dir
- no password for this repo"
test
"
$bOptAll
"
-eq
"1"
&&
echo
"SKIP:
$_dir
- no password for this repo"
...
...
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