logger: do not log to stdout/stderr

This commit is contained in:
Calin Crisan 2019-03-26 22:57:21 +02:00
parent a70281169f
commit a915ed3ae3
7 changed files with 18 additions and 18 deletions

View File

@ -31,7 +31,7 @@ watch() {
while true; do while true; do
sleep 5 sleep 5
if ! running; then if ! running; then
logger -t hostapd -s "dead, calling panic action" logger -t hostapd "dead, calling panic action"
panic_action hostapd panic_action hostapd
break break
fi fi

View File

@ -42,9 +42,9 @@ watch() {
else else
if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then
count=$((${count} + 5)) count=$((${count} + 5))
logger -t wifi -s "disconnected" logger -t wifi "disconnected"
else else
logger -t wifi -s "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action" logger -t wifi "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action"
panic_action wifi panic_action wifi
fi fi
fi fi

View File

@ -37,9 +37,9 @@ watch() {
else else
if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then
count=$((${count} + 5)) count=$((${count} + 5))
logger -t ppp -s "disconnected" logger -t ppp "disconnected"
else else
logger -t ppp -s "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action" logger -t ppp "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action"
panic_action ppp panic_action ppp
fi fi
fi fi

View File

@ -44,7 +44,7 @@ start() {
count=$((${count} + 1)) count=$((${count} + 1))
if [[ ${count} -ge 10 ]]; then if [[ ${count} -ge 10 ]]; then
msg_fail "no device" msg_fail "no device"
logger -t bluetooth -s "bluetooth device not available, calling panic action" logger -t bluetooth "bluetooth device not available, calling panic action"
panic_action bluetooth panic_action bluetooth
return 1 return 1
fi fi

View File

@ -28,9 +28,9 @@ watch_eth() {
else else
if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then
count=$((${count} + 5)) count=$((${count} + 5))
logger -t ethernet -s "disconnected" logger -t ethernet "disconnected"
else else
logger -t ethernet -s "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action" logger -t ethernet "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action"
panic_action network panic_action network
fi fi
fi fi
@ -47,9 +47,9 @@ watch_ip() {
else else
if [[ ${count} -lt ${IP_WATCH_TIMEOUT} ]]; then if [[ ${count} -lt ${IP_WATCH_TIMEOUT} ]]; then
count=$((${count} + 5)) count=$((${count} + 5))
logger -t network -s "${iface} has no IP address" logger -t network "${iface} has no IP address"
else else
logger -t network -s "${iface} had no IP address for ${IP_WATCH_TIMEOUT} seconds, calling panic action" logger -t network "${iface} had no IP address for ${IP_WATCH_TIMEOUT} seconds, calling panic action"
panic_action network panic_action network
fi fi
fi fi
@ -176,11 +176,11 @@ start() {
if [[ "${eth_ok}" != "ok" ]] && [[ "${wlan_ok}" != "ok" ]] && [[ "${ppp_ok}" != "ok" ]]; then if [[ "${eth_ok}" != "ok" ]] && [[ "${wlan_ok}" != "ok" ]] && [[ "${ppp_ok}" != "ok" ]]; then
if [[ "${LINK_WATCH}" == "true" ]]; then if [[ "${LINK_WATCH}" == "true" ]]; then
logger -t network -s "no network connection available, calling panic action" logger -t network "no network connection available, calling panic action"
panic_action network panic_action network
return 1 return 1
else else
logger -t network -s "no network connection available" logger -t network "no network connection available"
return 0 return 0
fi fi
fi fi

View File

@ -28,11 +28,11 @@ watch() {
count=0 count=0
else else
if [[ ${count} -lt ${NETWATCH_RETRIES} ]]; then if [[ ${count} -lt ${NETWATCH_RETRIES} ]]; then
logger -t netwatch -s "cannot connect to ${NETWATCH_HOST}:${NETWATCH_PORT}" logger -t netwatch "cannot connect to ${NETWATCH_HOST}:${NETWATCH_PORT}"
count=$((${count} + 1)) count=$((${count} + 1))
continue continue
else else
logger -t netwatch -s "cannot connect to ${NETWATCH_HOST}:${NETWATCH_PORT}, calling panic action" logger -t netwatch "cannot connect to ${NETWATCH_HOST}:${NETWATCH_PORT}, calling panic action"
panic_action netwatch panic_action netwatch
fi fi
fi fi

View File

@ -35,10 +35,10 @@ set_current_date_http() {
date_str=$(curl -v -s -m ${DATE_TIMEOUT} -X GET http://${DATE_HOST} 2>&1 | grep Date | sed -e 's/< Date: //') date_str=$(curl -v -s -m ${DATE_TIMEOUT} -X GET http://${DATE_HOST} 2>&1 | grep Date | sed -e 's/< Date: //')
if [[ -n "${date_str}" ]]; then if [[ -n "${date_str}" ]]; then
${PROG_DATE} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null ${PROG_DATE} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null
logger -t date -s "current system date/time set to $(date) via HTTP" logger -t date "current system date/time set to $(date) via HTTP"
return 0 return 0
else else
logger -t date -s "failed to set current system date/time via HTTP" logger -t date "failed to set current system date/time via HTTP"
return 1 return 1
fi fi
} }
@ -46,10 +46,10 @@ set_current_date_http() {
set_current_date_ntp() { set_current_date_ntp() {
cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ${PROG_NTPDATE} -t ${DATE_TIMEOUT} -s cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ${PROG_NTPDATE} -t ${DATE_TIMEOUT} -s
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
logger -t date -s "current system date/time set to $(date) via NTP" logger -t date "current system date/time set to $(date) via NTP"
return 0 return 0
else else
logger -t date -s "failed to set current system date/time via NTP" logger -t date "failed to set current system date/time via NTP"
return 1 return 1
fi fi
} }