Log output to file

Path is hard coded. Should improve this.
main
mj-saunders 2022-11-03 15:06:01 +04:00
parent 74a2fc4513
commit 12f12efb9b
1 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,13 @@
#set -eux
LOG_FILE="/media/workshop/Projects/openmedianetwork/.omn_watchdog.log"
touch ${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
RECIPIENTS=(
saunders@openworlds.info
witchescauldron@openworlds.info
@ -41,11 +48,13 @@ send_mail() {
cat mail_template \
| sed "s/{ERR_LIST}/${error_string}/g" \
| msmtp -a omn_server_watch ${RECIPIENTS[@]} 2>/dev/null
| msmtp -a omn_server_watch ${RECIPIENTS[@]} 2>/dev/null \
|| echo "[ERROR] Failed to send mail!"
}
declare -A FLAGGED
echo "== $(date)"
echo "== Checking:"
for uri in "${URLS[@]}"; do \