Use new log directory format. Set RET for mailx errors.

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-29 21:07:21 +00:00
commit 290becc777
2 changed files with 8 additions and 8 deletions

View file

@ -8,8 +8,8 @@
# Configuration.
COMMAND="/opt/bin/sbosrcarch"
LOGSDIR="/var/log/mirroring/$(printf "%(%Y/%m)T")"
LOGFILE="$(printf "%(%Y%m%d-%H%M%S)T")-sbosrcharch-$$"
LOGSDIR="/var/log/duplication/sbosrcarch/$(printf "%(%Y/%m)T")"
LOGFILE="$(printf "%(%Y%m%d-%H%M%S)T")-$$"
# Only allow one copy of the script to run at any time.
# shellcheck disable=SC2154
@ -54,7 +54,7 @@ printf "\\n" >>"$LOGSDIR/$LOGFILE"
if (( "$ERR" == 0 )); then
if [[ -n "${EMAIL_TO[*]}" ]]; then
mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "SBosrcarch report" "${EMAIL_TO[@]}" <<-EOF 2>/dev/null || \
printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2
{ printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2; RET=1; }
Exit code: $ERR
Logfile: $LOGSDIR/$LOGFILE.gz
Output:
@ -69,7 +69,7 @@ else
[[ -x "/opt/bin/pushover" ]] && CONFIG_FILE="mirroring" /opt/bin/pushover -T "SBosrcarch" -p '-1' -m "SBosrcarch failed"
if [[ -n "${EMAIL_TO[*]}" ]]; then
mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "SBosrcarch failure" "${EMAIL_TO[@]}" <<-EOF 2>/dev/null || \
printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2
{ printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2; RET=1; }
Exit code: $ERR
Logfile: $LOGSDIR/$LOGFILE.gz
Output: