diff --git a/mirror-wrapper b/mirror-wrapper index c810829..d9de8a5 100755 --- a/mirror-wrapper +++ b/mirror-wrapper @@ -62,17 +62,19 @@ mkdir -p -m 750 "$LOGSDIR" 2>/dev/null || { "$COMMAND" "$@" >"$LOGSDIR/$LOGFILE" 2>&1 ERR="$?" -# Compress the log to save some space. -xz -9 "$LOGSDIR/$LOGFILE" 2>/dev/null || printf "%s: %s\\n" "${0##*/}" "failed to compress '$LOGSDIR/$LOGFILE'" >&2 - # Tell the sysadmin what went on. if (( "$ERR" == 0 )); then # Only email a mirroring report if it's not the hourly Slackware tree only run. # The size of the log file determines if it gets emailed. (( $(stat --printf="%s" "$LOGSDIR/$LOGFILE") > MIN_LOGFILE_SIZE )) && notify "report" - exit "$?" + ERR="$?" else # Mirroring failed, tell the admin. notify "failure" || [[ -x /opt/bin/pushover-client ]] && /opt/bin/pushover-client "mirroring" -p -1 -s "Mirroring failure" -m "Check log in email" - exit 1 + ERR="1" fi + +# Compress the log to save some space. +xz -9 "$LOGSDIR/$LOGFILE" 2>/dev/null || printf "%s: %s\\n" "${0##*/}" "failed to compress '$LOGSDIR/$LOGFILE'" >&2 + +exit "$ERR"