Use new log directory format. Set RET for mailx errors.
This commit is contained in:
parent
b09e6e685d
commit
290becc777
2 changed files with 8 additions and 8 deletions
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
# Configuration.
|
||||
COMMAND="/opt/bin/mirror"
|
||||
LOGSDIR="/var/log/mirroring/$(printf "%(%Y/%m)T")"
|
||||
LOGFILE="$(printf "%(%Y%m%d-%H%M%S)T")-mirroring-$$"
|
||||
LOGSDIR="/var/log/duplication/mirroring/$(printf "%(%Y/%m)T")"
|
||||
LOGFILE="$(printf "%(%Y%m%d-%H%M%S)T")-$$"
|
||||
MIN_LOGFILE_SIZE="550"
|
||||
|
||||
# Only allow one copy of the script to run at any time.
|
||||
|
|
@ -56,7 +56,7 @@ if (( "$ERR" == 0 )); then
|
|||
(( $(stat --printf="%s" "$LOGSDIR/$LOGFILE") > MIN_LOGFILE_SIZE )) && {
|
||||
if [[ -n "${EMAIL_TO[*]}" ]]; then
|
||||
mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "Mirroring 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:
|
||||
|
|
@ -72,7 +72,7 @@ else
|
|||
[[ -x "/opt/bin/pushover" ]] && CONFIG_FILE="mirroring" /opt/bin/pushover -T "Mirroring" -p '-1' -m "Mirroring failed"
|
||||
if [[ -n "${EMAIL_TO[*]}" ]]; then
|
||||
mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "Mirroring 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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue