In mirror-wrapper, compress the logs /after/ they are emailed.
This commit is contained in:
parent
be4d10eeba
commit
2eb0c75bdc
1 changed files with 7 additions and 5 deletions
|
|
@ -62,17 +62,19 @@ mkdir -p -m 750 "$LOGSDIR" 2>/dev/null || {
|
||||||
"$COMMAND" "$@" >"$LOGSDIR/$LOGFILE" 2>&1
|
"$COMMAND" "$@" >"$LOGSDIR/$LOGFILE" 2>&1
|
||||||
ERR="$?"
|
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.
|
# Tell the sysadmin what went on.
|
||||||
if (( "$ERR" == 0 )); then
|
if (( "$ERR" == 0 )); then
|
||||||
# Only email a mirroring report if it's not the hourly Slackware tree only run.
|
# 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.
|
# The size of the log file determines if it gets emailed.
|
||||||
(( $(stat --printf="%s" "$LOGSDIR/$LOGFILE") > MIN_LOGFILE_SIZE )) && notify "report"
|
(( $(stat --printf="%s" "$LOGSDIR/$LOGFILE") > MIN_LOGFILE_SIZE )) && notify "report"
|
||||||
exit "$?"
|
ERR="$?"
|
||||||
else
|
else
|
||||||
# Mirroring failed, tell the admin.
|
# 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"
|
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
|
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"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue