bundles/backup-client: more logging, fix wrong variable name
This commit is contained in:
parent
c14bb43993
commit
bb519adb2c
1 changed files with 6 additions and 2 deletions
|
@ -7,6 +7,7 @@ NL=$'\n'
|
||||||
|
|
||||||
if ! [[ -f /etc/backup.priv ]]
|
if ! [[ -f /etc/backup.priv ]]
|
||||||
then
|
then
|
||||||
|
echo "/etc/backup.priv does not exist" | logger -t backup-client -p user.error
|
||||||
echo "abort_no_key" > "$statusfile"
|
echo "abort_no_key" > "$statusfile"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -15,6 +16,7 @@ run-parts --exit-on-error -- /etc/backup-pre-hooks.d
|
||||||
exitcode=$?
|
exitcode=$?
|
||||||
if [[ $exitcode != 0 ]]
|
if [[ $exitcode != 0 ]]
|
||||||
then
|
then
|
||||||
|
echo "run-parts /etc/backup-pre-hooks.d exited $exitcode" | logger -t backup-client -p user.error
|
||||||
echo "hook $exitcode" > "$statusfile"
|
echo "hook $exitcode" > "$statusfile"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -25,7 +27,7 @@ do_backup() {
|
||||||
|
|
||||||
for try in {1..5}
|
for try in {1..5}
|
||||||
do
|
do
|
||||||
echo "Running Backup for $1, try $try ..." >&2
|
echo "Backup for '$1', try $try ..." | logger -t backup-client -p user.info
|
||||||
|
|
||||||
# Compress level 1 is a good compromise between speed and cpu usage.
|
# Compress level 1 is a good compromise between speed and cpu usage.
|
||||||
rsync --compress-level=1 -aAP --numeric-ids --delete --relative \
|
rsync --compress-level=1 -aAP --numeric-ids --delete --relative \
|
||||||
|
@ -36,6 +38,7 @@ do_backup() {
|
||||||
# Exit code 24 means some files have vanished during rsync.
|
# Exit code 24 means some files have vanished during rsync.
|
||||||
# I don't know why, but this is very common, apparently?
|
# I don't know why, but this is very common, apparently?
|
||||||
exitcode=$?
|
exitcode=$?
|
||||||
|
echo "Backup for '$1' try $try exited $exitcode" | logger -t backup-client -p user.info
|
||||||
if [[ $exitcode != 0 ]] && [[ $exitcode != 24 ]]
|
if [[ $exitcode != 0 ]] && [[ $exitcode != 24 ]]
|
||||||
then
|
then
|
||||||
rsync_errorcodes_for_this_path+=" $exitcode"
|
rsync_errorcodes_for_this_path+=" $exitcode"
|
||||||
|
@ -48,8 +51,9 @@ do_backup() {
|
||||||
|
|
||||||
if [[ "$backup_has_successfully_run" != "yes" ]]
|
if [[ "$backup_has_successfully_run" != "yes" ]]
|
||||||
then
|
then
|
||||||
|
echo "Backup for '$1' did not succeed!" | logger -t backup-client -p user.error
|
||||||
<%text>
|
<%text>
|
||||||
rsync_errors+="${NL}${1}${rsync_errors_for_this_path}"
|
rsync_errors+="${NL}${1}${rsync_errorcodes_for_this_path}"
|
||||||
</%text>
|
</%text>
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue