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