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
d384ba65
Commit
d384ba65
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check: update after changes in logging
parent
62673cab
No related branches found
No related tags found
1 merge request
!35
5046 finetune restic params
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
check_clientbackup.sh
+34
-21
34 additions, 21 deletions
check_clientbackup.sh
plugins/transfer/restic.sh
+3
-2
3 additions, 2 deletions
plugins/transfer/restic.sh
transfer.sh
+1
-1
1 addition, 1 deletion
transfer.sh
with
38 additions
and
24 deletions
check_clientbackup.sh
+
34
−
21
View file @
d384ba65
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#
#
# 2016-12-09 ah,ds v1.0
# 2016-12-09 ah,ds v1.0
# 2022-01-19 ah v1.1 fixes with shellcheck
# 2022-01-19 ah v1.1 fixes with shellcheck
# 2022-02-09 ah v1.2 update after changes in logging
# ==============================================================================
# ==============================================================================
.
$(
dirname
$0
)
/jobhelper.sh
.
$(
dirname
$0
)
/jobhelper.sh
...
@@ -39,7 +40,7 @@ logdir=$(dirname "$0")/logs
...
@@ -39,7 +40,7 @@ logdir=$(dirname "$0")/logs
sShort
=
"Client Backup -"
sShort
=
"Client Backup -"
ls
"
$logdir
"
/
*
.log
>
/dev/null
ls
"
$logdir
"
/
*
.log
*
>
/dev/null
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
sShort
=
"
$sShort
logs were not found. Backup was never executed"
sShort
=
"
$sShort
logs were not found. Backup was never executed"
iError
=
1
iError
=
1
...
@@ -48,13 +49,23 @@ else
...
@@ -48,13 +49,23 @@ else
# iMaxAgeInHours=`j_getLastBackupAge`
# iMaxAgeInHours=`j_getLastBackupAge`
# echo verify last backup: $iMaxAgeInHours h ago
# echo verify last backup: $iMaxAgeInHours h ago
for
logfile
in
$(
ls
-1t
"
$logdir
"
/inc
*
.log
"
$logdir
"
/full
*
.log
"
$logdir
"
/auto
*
.log 2>/dev/null |
head
-1
)
do
# for logfile in $(ls -1t "$logdir"/inc*.log "$logdir"/full*.log "$logdir"/auto*.log 2>/dev/null | head -1)
# do
backuplogfile
=
$(
ls
-1t
"
$logdir
"
/inc
*
.log
"
$logdir
"
/full
*
.log
"
$logdir
"
/auto
*
.log 2>/dev/null |
head
-1
)
transferlogfile
=
$(
ls
-1t
"
$logdir
"
/transfer
*
.log |
head
-1
)
logfile
=
"
${
backuplogfile
}
${
transferlogfile
}
"
lastlogfile
=
"
$(
ls
-1t
$logfile
|
head
-1
)
"
echo
LAST BACKUP:
"
$logfile
"
echo
LAST BACKUP:
"
$logfile
"
grep
"final.*rc="
"
$logfile
"
echo
echo
">>> RETURNCODES"
grep
"final.*rc="
$logfile
echo
echo
# ---
SENSU
Statusline
# ---
Monitoring
Statusline
if
[
-f
"
$(
dirname
$0
)
"
/transfer.sh
]
;
then
if
[
-f
"
$(
dirname
$0
)
"
/transfer.sh
]
;
then
sShort
=
"
$sShort
WITH"
sShort
=
"
$sShort
WITH"
else
else
...
@@ -63,8 +74,8 @@ else
...
@@ -63,8 +74,8 @@ else
sShort
=
"
$sShort
transfer -"
sShort
=
"
$sShort
transfer -"
# --- count returncodes
# --- count returncodes
iOK
=
$(
grep
-c
"final.*rc=0$"
"
$logfile
"
)
iOK
=
$(
grep
"final.*rc=0$"
$logfile
|
wc
-l
)
iError
=
$(
grep
"final.*rc="
"
$logfile
"
|
grep
-
c
v
"rc=0$"
)
iError
=
$(
grep
"final.*rc="
$logfile
|
grep
-v
"rc=0$"
|
wc
-l
)
echo
"OK:
$iOK
... Errors:
$iError
"
echo
"OK:
$iOK
... Errors:
$iError
"
# --- rc=0 must be here
# --- rc=0 must be here
...
@@ -74,10 +85,12 @@ else
...
@@ -74,10 +85,12 @@ else
fi
fi
# --- check age
# --- check age
iAge
=
$(
date
+%s
)
-
$(
date
+%s
-r
"
$logfile
"
)
echo
echo
">>> AGE"
iAge
=
$(
date
+%s
)
-
$(
date
+%s
-r
"
$lastlogfile
"
)
iAge2
=
$iAge
/60/60
iAge2
=
$iAge
/60/60
echo
"age:
$iAge
sec ...
$iAge2
h"
echo
"age:
$iAge
sec ...
$iAge2
h"
sShort
=
"
$sShort
last backup log:
$(
basename
"
$logfile
"
)
(
$iAge2
h ago) "
sShort
=
"
$sShort
last backup log:
$(
basename
"
$
last
logfile
"
)
(
$iAge2
h ago) "
if
[
$iAge2
-gt
$iMaxAgeInHours
]
;
then
if
[
$iAge2
-gt
$iMaxAgeInHours
]
;
then
echo
"Error: the last backup is older than
$iMaxAgeInHours
hours"
echo
"Error: the last backup is older than
$iMaxAgeInHours
hours"
sShort
=
"
$sShort
ERROR: backup is older than
$iMaxAgeInHours
hours "
sShort
=
"
$sShort
ERROR: backup is older than
$iMaxAgeInHours
hours "
...
@@ -88,22 +101,22 @@ else
...
@@ -88,22 +101,22 @@ else
fi
fi
# --- changes (incremental backups only) and backup status infos
# --- changes (incremental backups only) and backup status infos
echo
#
echo
sSearch
=
"Args:|ElapsedTime|SourceFiles|SourceFileSize|RawDeltaSize"
#
sSearch="Args:|ElapsedTime|SourceFiles|SourceFileSize|RawDeltaSize"
echo
"
$logfile
"
|
grep
-F
"inc"
>
/dev/null
#
echo "$logfile" | grep -F "inc" >/dev/null
if
[
$?
-eq
0
]
;
then
#
if [ $? -eq 0 ]; then
sSearch
=
"[ADM]
\
|
${
sSearch
}
"
#
sSearch="[ADM]\ |${sSearch}"
fi
#
fi
echo
---
changes:
#
echo --- changes:
grep
-E
"^(
${
sSearch
}
)"
"
$logfile
"
#
grep -E "^(${sSearch})" "$logfile"
echo
echo
echo
---
s
ummary of backed up directories:
echo
">>> S
ummary of backed up directories:
"
grep
"DIR
\
"
"
$logfile
"
cat
$logfile
|
grep
"DIR
\
"
|
sort
-u
sShort
=
"
$sShort
- OK:
$iOK
... Errors:
$iError
"
sShort
=
"
$sShort
- OK:
$iOK
... Errors:
$iError
"
done
#
done
fi
fi
...
...
This diff is collapsed.
Click to expand it.
plugins/transfer/restic.sh
+
3
−
2
View file @
d384ba65
...
@@ -7,8 +7,9 @@
...
@@ -7,8 +7,9 @@
#
#
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
# ah - Axel Hahn <axel.hahn@iml.unibe.ch>
# ah - Axel Hahn <axel.hahn@iml.unibe.ch>
# 2021-05-19 ah v0.0 INIT ... WIP
# 2021-05-19 ah v0.1 INIT ... WIP
# 2022-01-06 ah v0.0 added support for Repository with REST and authentication
# 2022-01-06 ah v0.2 added support for Repository with REST and authentication
# 2022-02-09 ah v0.3 show difff to last backup; update pruning
# ================================================================================
# ================================================================================
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
transfer.sh
+
1
−
1
View file @
d384ba65
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
METHOD
=
METHOD
=
transferlog
=
"
${
DIR_LOGS
}
/transfer-
`
date
+%Y%m%d
`
.log"
transferlog
=
"
${
DIR_LOGS
}
/transfer-
$(
date
+%Y%m%d
-%H%M%S
)
.log"
lockfile
=
"
${
DIR_LOGS
}
/transfer.running"
lockfile
=
"
${
DIR_LOGS
}
/transfer.running"
rcfile
=
/tmp/transfer-rc.
$$
.tmp
rcfile
=
/tmp/transfer-rc.
$$
.tmp
...
...
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