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
4d12d315
Commit
4d12d315
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
backup-status.sh v1.5 - handle multiple backup tools
parent
3cd74416
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
backup-status.sh
+37
-38
37 additions, 38 deletions
backup-status.sh
with
40 additions
and
38 deletions
.gitignore
0 → 100644
+
3
−
0
View file @
4d12d315
# ignore files of a local instance
inc_config.sh
log/c*
This diff is collapsed.
Click to expand it.
backup-status.sh
+
37
−
38
View file @
4d12d315
...
...
@@ -8,6 +8,7 @@
# 2018-02-14 v1.1 hahn configure time limit
# 2019-10-20 v1.3 hahn source inc_config.sh
# 2020-12-07 v1.4 hahn deactivate backup
# 2021-06-16 v1.5 hahn handle multiple backup tools
# ----------------------------------------------------------------------
...
...
@@ -15,7 +16,7 @@
cd
${
sBackupBasedir
}
||
exit
1
sVersion
=
1.
4
sVersion
=
1.
5
typeset
-i
iErrors
=
0
typeset
-i
iHours
=
36
typeset
-i
iMinutes
=
$iHours
*
60
...
...
@@ -60,7 +61,7 @@ function _getFileAge(){
function
getServers
(){
# ls -1 | fgrep "iml.unibe.ch"
ls
-1
|
grep
-Ev
"
^
(_active|SOMETHINGELSE)"
ls
-1
d
*
/
*
|
grep
-Ev
"
/
(_active|
#recycle|
SOMETHINGELSE)"
}
...
...
@@ -94,7 +95,7 @@ function _checkDir(){
echo
else
echo
"SKIP:
$mydir
won't be scanned."
echo
"SKIP:
$mydir
won't be scanned.
It isn't a directory.
"
fi
}
...
...
@@ -118,43 +119,41 @@ echo
echo
"changed files last
$iHours
hours and used diskspace:"
echo
# _checkDir .
echo
echo
"... and by server and backup sets:"
echo
for
myserver
in
`
getServers
`
do
color
head
echo
-----
$myserver
color reset
# echo
# echo "... and by server and backup sets:"
# echo
for
myserver
in
`
getServers
`
do
color
head
echo
-----
SERVER:
$myserver
color reset
echo
if
[
-f
$myserver
/
$sInactiveFile
]
;
then
du
-hs
$myserver
echo
if
[
-f
$myserver
/
$sInactiveFile
]
;
then
du
-hs
$myserver
echo
echo
"INFO: server is marked as inactive."
ls
-l
$myserver
/
$sInactiveFile
cat
$myserver
/
$sInactiveFile
typeset
-i
iAge
=
`
_getFileAge "
$myserver
/
$sInactiveFile
"
`
typeset
-i
iDays
=
$iKeepBackups
-
$iAge
/60/60/24
# echo Age: $iAge s
if
[
$iDays
-lt
0
]
;
then
color error
echo
"ERROR: Outdated backup was found! You can delete data for
$myserver
."
color reset
iErrors
=
$iErrors
+1
else
echo
"INFO: keeping it
$iKeepBackups
d ..
$iDays
d left."
fi
echo
"INFO: server is marked as inactive."
ls
-l
$myserver
/
$sInactiveFile
cat
$myserver
/
$sInactiveFile
typeset
-i
iAge
=
`
_getFileAge "
$myserver
/
$sInactiveFile
"
`
typeset
-i
iDays
=
$iKeepBackups
-
$iAge
/60/60/24
# echo Age: $iAge s
if
[
$iDays
-lt
0
]
;
then
color error
echo
"ERROR: Outdated backup was found! You can delete data for
$myserver
."
color reset
iErrors
=
$iErrors
+1
else
echo
_checkDir
$myserver
for
subdir
in
`
ls -1
$myserver
`
do
_checkDir
$myserver
/
$subdir
done
echo
"INFO: keeping it
$iKeepBackups
d ..
$iDays
d left."
fi
echo
done
else
_checkDir
$myserver
echo
$myserver
|
grep
"restic-backup"
>
/dev/null
||
for
subdir
in
`
ls -1
$myserver
`
do
_checkDir
$myserver
/
$subdir
done
fi
echo
done
# --- show result
...
...
@@ -164,7 +163,7 @@ if [ $iErrors -eq 0 ]; then
echo
"OK"
else
color error
echo
"
$iE
rrors
Errors
detected.
"
echo
"
Found e
rrors
:
$i
Errors
"
fi
color reset
...
...
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