Do not hard code the log file
We log to file only if WATCHDOG_LOG is set, otherwise we output to stdout as usual.main
parent
2ae1e0eb5b
commit
f20a4344d5
|
@ -5,6 +5,8 @@
|
|||
# Any servers in URLS that yield a bad response are collated and sent via email
|
||||
# to all RECIPIENTS.
|
||||
#
|
||||
# If WATCHDOG_LOG is set, all output will be redirected there.
|
||||
#
|
||||
# Dependencies
|
||||
# - curl: Polling the servers
|
||||
# - msmtp: Sending email; requires separate configuration
|
||||
|
@ -12,8 +14,6 @@
|
|||
|
||||
#set -eux
|
||||
|
||||
LOG_FILE="/media/workshop/Projects/openmedianetwork/.omn_watchdog.log"
|
||||
|
||||
RECIPIENTS=(
|
||||
saunders@openworlds.info
|
||||
witchescauldron@openworlds.info
|
||||
|
@ -44,10 +44,12 @@ main()
|
|||
{
|
||||
declare -A FLAGGED
|
||||
|
||||
rotate_log LOG_FILE
|
||||
# Redirect all output to LOG_FILE but preserve a link to stdout should we
|
||||
# still want to use it
|
||||
exec 3>&1 1>>${LOG_FILE} 2>&1
|
||||
if [ -n "${WATCHDOG_LOG}" ]; then
|
||||
rotate_log WATCHDOG_LOG
|
||||
# Redirect all output to WATCHDOG_LOG but preserve a link to stdout should we
|
||||
# still want to use it
|
||||
exec 3>&1 1>>${WATCHDOG_LOG} 2>&1
|
||||
fi
|
||||
|
||||
echo ">> $(date)"
|
||||
echo "== Checking:"
|
||||
|
|
Loading…
Reference in New Issue