bundles/backup-client: actually show which rsync call produced which error
This commit is contained in:
parent
1ae328d8f3
commit
e596b45344
2 changed files with 11 additions and 9 deletions
|
@ -17,20 +17,22 @@ if now-mtime > 60*60*24*2:
|
|||
exit(3)
|
||||
|
||||
with open(statusfile, 'r') as f:
|
||||
status = f.read().split()
|
||||
status = f.read().splitlines()
|
||||
|
||||
if status[0] == 'ok':
|
||||
exitcode = status[0].strip()
|
||||
|
||||
if exitcode == 'ok':
|
||||
print('OK')
|
||||
exit(0)
|
||||
elif status[0] == 'rsync_error':
|
||||
print('rsync produced some errors, exit codes were: {}'.format(
|
||||
', '.join(status[1:])
|
||||
))
|
||||
elif exitcode == 'rsync_error':
|
||||
print('rsync produced some errors, exit codes were:')
|
||||
for line in status[1:]:
|
||||
print(line)
|
||||
exit(2)
|
||||
elif status[0] == 'hook':
|
||||
elif exitcode == 'hook':
|
||||
print('run-parts /etc/backup-pre-hook.d failed with exit code {}'.format(status[1]))
|
||||
exit(2)
|
||||
elif status[0] == 'abort_no_key':
|
||||
elif exitcode == 'abort_no_key':
|
||||
print('no ssh key found in /etc/backup.priv!')
|
||||
exit(1)
|
||||
else:
|
||||
|
|
|
@ -29,7 +29,7 @@ do_backup() {
|
|||
exitcode=$?
|
||||
if [[ $exitcode != 0 ]] && [[ $exitcode != 24 ]]
|
||||
then
|
||||
rsync_errors+=" $exitcode"
|
||||
rsync_errors+="\n$1 $exitcode"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue