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
No related branches found
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 @@
...
@@ -8,6 +8,7 @@
# 2018-02-14 v1.1 hahn configure time limit
# 2018-02-14 v1.1 hahn configure time limit
# 2019-10-20 v1.3 hahn source inc_config.sh
# 2019-10-20 v1.3 hahn source inc_config.sh
# 2020-12-07 v1.4 hahn deactivate backup
# 2020-12-07 v1.4 hahn deactivate backup
# 2021-06-16 v1.5 hahn handle multiple backup tools
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -15,7 +16,7 @@
...
@@ -15,7 +16,7 @@
cd
${
sBackupBasedir
}
||
exit
1
cd
${
sBackupBasedir
}
||
exit
1
sVersion
=
1.
4
sVersion
=
1.
5
typeset
-i
iErrors
=
0
typeset
-i
iErrors
=
0
typeset
-i
iHours
=
36
typeset
-i
iHours
=
36
typeset
-i
iMinutes
=
$iHours
*
60
typeset
-i
iMinutes
=
$iHours
*
60
...
@@ -60,7 +61,7 @@ function _getFileAge(){
...
@@ -60,7 +61,7 @@ function _getFileAge(){
function
getServers
(){
function
getServers
(){
# ls -1 | fgrep "iml.unibe.ch"
# 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(){
...
@@ -94,7 +95,7 @@ function _checkDir(){
echo
echo
else
else
echo
"SKIP:
$mydir
won't be scanned."
echo
"SKIP:
$mydir
won't be scanned.
It isn't a directory.
"
fi
fi
}
}
...
@@ -118,43 +119,41 @@ echo
...
@@ -118,43 +119,41 @@ echo
echo
"changed files last
$iHours
hours and used diskspace:"
echo
"changed files last
$iHours
hours and used diskspace:"
echo
echo
# _checkDir .
# _checkDir .
echo
# echo
echo
"... and by server and backup sets:"
# echo "... and by server and backup sets:"
echo
# echo
for
myserver
in
`
getServers
`
for
myserver
in
`
getServers
`
do
do
color
head
color
head
echo
-----
SERVER:
$myserver
echo
-----
$myserver
color reset
color reset
echo
if
[
-f
$myserver
/
$sInactiveFile
]
;
then
du
-hs
$myserver
echo
echo
if
[
-f
$myserver
/
$sInactiveFile
]
;
then
echo
"INFO: server is marked as inactive."
du
-hs
$myserver
ls
-l
$myserver
/
$sInactiveFile
echo
cat
$myserver
/
$sInactiveFile
echo
"INFO: server is marked as inactive."
typeset
-i
iAge
=
`
_getFileAge "
$myserver
/
$sInactiveFile
"
`
ls
-l
$myserver
/
$sInactiveFile
typeset
-i
iDays
=
$iKeepBackups
-
$iAge
/60/60/24
cat
$myserver
/
$sInactiveFile
# echo Age: $iAge s
typeset
-i
iAge
=
`
_getFileAge "
$myserver
/
$sInactiveFile
"
`
if
[
$iDays
-lt
0
]
;
then
typeset
-i
iDays
=
$iKeepBackups
-
$iAge
/60/60/24
color error
# echo Age: $iAge s
echo
"ERROR: Outdated backup was found! You can delete data for
$myserver
."
if
[
$iDays
-lt
0
]
;
then
color reset
color error
iErrors
=
$iErrors
+1
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
else
else
echo
echo
"INFO: keeping it
$iKeepBackups
d ..
$iDays
d left."
_checkDir
$myserver
for
subdir
in
`
ls -1
$myserver
`
do
_checkDir
$myserver
/
$subdir
done
fi
fi
echo
else
done
_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
# --- show result
...
@@ -164,7 +163,7 @@ if [ $iErrors -eq 0 ]; then
...
@@ -164,7 +163,7 @@ if [ $iErrors -eq 0 ]; then
echo
"OK"
echo
"OK"
else
else
color error
color error
echo
"
$iE
rrors
Errors
detected.
"
echo
"
Found e
rrors
:
$i
Errors
"
fi
fi
color reset
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