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