mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-02-17 09:23:56 +00:00
Do not exit on backup failure
Exit caused email notifications to be not sent when backup fails. We especially want to be notified if a backup fails.
This commit is contained in:
11
backup.sh
11
backup.sh
@@ -31,18 +31,17 @@ logLast "AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}"
|
||||
|
||||
# Do not save full backup log to logfile but to backup-last.log
|
||||
restic backup /data ${RESTIC_JOB_ARGS} --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> ${lastLogfile} 2>&1
|
||||
rc=$?
|
||||
backupRC=$?
|
||||
logLast "Finished backup at $(date)"
|
||||
if [[ $rc == 0 ]]; then
|
||||
echo "Backup Successfull"
|
||||
if [[ $backupRC == 0 ]]; then
|
||||
echo "Backup Successfull"
|
||||
else
|
||||
echo "Backup Failed with Status ${rc}"
|
||||
echo "Backup Failed with Status ${backupRC}"
|
||||
restic unlock
|
||||
copyErrorLog
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${RESTIC_FORGET_ARGS}" ]; then
|
||||
if [[ $backupRC == 0 ]] && [ -n "${RESTIC_FORGET_ARGS}" ]; then
|
||||
echo "Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS}"
|
||||
restic forget ${RESTIC_FORGET_ARGS} >> ${lastLogfile} 2>&1
|
||||
rc=$?
|
||||
|
||||
Reference in New Issue
Block a user