Skip to content

Commit

Permalink
added "set -e" to let createBackup.sh exit immediately upon an error.
Browse files Browse the repository at this point in the history
Furthermore cronBackup.sh now triggers a WebUI alarm in case the target
dir could not be created ot the executed createBackup.sh exits wit an
error. This closes #1320.
  • Loading branch information
jens-maus committed Jun 23, 2021
1 parent ac6958f commit 56eb95b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions buildroot-external/overlay/base-raspmatic/bin/createBackup.sh
Expand Up @@ -21,6 +21,9 @@
# createBackup.sh <directory/file>
#

# Stop on error
set -e

# default backup destination directory
BACKUPDIR=/usr/local/tmp

Expand Down
6 changes: 5 additions & 1 deletion buildroot-external/overlay/base-raspmatic/bin/cronBackup.sh
Expand Up @@ -59,6 +59,7 @@ fi
# if BACKUPDIR does not exist, create it
if [ ! -e "${BACKUPDIR}" ]; then
if ! mkdir "${BACKUPDIR}"; then
/bin/triggerAlarm.tcl "cronBackup: Could not create ${BACKUPDIR}" WatchDog-Alarm
exit 1
fi
fi
Expand All @@ -70,7 +71,10 @@ if [ ! -f "${BACKUPDIR}/.nobackup" ]; then
fi

# create the backup in BACKUPDIR now
/bin/createBackup.sh "${BACKUPDIR}"
if ! /bin/createBackup.sh "${BACKUPDIR}"; then
/bin/triggerAlarm.tcl "cronBackup: Backup job failed" WatchDog-Alarm
exit 1
fi

# check how many backup files are actually in BACKUPDIR and cleanup
# until we reach MAXBACKUPS
Expand Down

0 comments on commit 56eb95b

Please sign in to comment.