mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
Init: watch conf vars are now uppercase
This commit is contained in:
parent
32f3cb2e9f
commit
504b6c3c22
@ -56,7 +56,7 @@ start() {
|
||||
iwconfig $iface power off &> /dev/null
|
||||
$PROG $CONF &> $LOG &
|
||||
|
||||
if [[ "$link_watch" == "yes" ]]; then
|
||||
if [[ "$LINK_WATCH" == "yes" ]]; then
|
||||
watch &
|
||||
fi
|
||||
|
||||
|
@ -39,11 +39,11 @@ watch() {
|
||||
if connected; then
|
||||
count=0
|
||||
else
|
||||
if [[ $count -lt $link_watch_timeout ]]; then
|
||||
if [[ $count -lt $LINK_WATCH_TIMEOUT ]]; then
|
||||
count=$(($count + 5))
|
||||
logger -t wifi -s "disconnected"
|
||||
else
|
||||
logger -t wifi -s "disconnected for $link_watch_timeout seconds, calling panic action"
|
||||
logger -t wifi -s "disconnected for $LINK_WATCH_TIMEOUT seconds, calling panic action"
|
||||
panic_action wifi
|
||||
fi
|
||||
fi
|
||||
@ -79,7 +79,7 @@ start() {
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $count -gt $link_watch_timeout ]] || ! pidof wpa_supplicant > /dev/null; then
|
||||
if [[ $count -gt $LINK_WATCH_TIMEOUT ]] || ! pidof wpa_supplicant > /dev/null; then
|
||||
test -n "$module" && msg_fail "failed ($module)"|| msg_fail
|
||||
return 1
|
||||
fi
|
||||
@ -87,7 +87,7 @@ start() {
|
||||
count=$(($count + 1))
|
||||
done
|
||||
|
||||
if [[ "$link_watch" == "true" ]]; then
|
||||
if [[ "$LINK_WATCH" == "true" ]]; then
|
||||
watch &
|
||||
fi
|
||||
|
||||
|
@ -33,11 +33,11 @@ watch() {
|
||||
if connected; then
|
||||
count=0
|
||||
else
|
||||
if [[ $count -lt $link_watch_timeout ]]; then
|
||||
if [[ $count -lt $LINK_WATCH_TIMEOUT ]]; then
|
||||
count=$(($count + 5))
|
||||
logger -t ppp -s "disconnected"
|
||||
else
|
||||
logger -t ppp -s "disconnected for $link_watch_timeout seconds, calling panic action"
|
||||
logger -t ppp -s "disconnected for $LINK_WATCH_TIMEOUT seconds, calling panic action"
|
||||
panic_action ppp
|
||||
fi
|
||||
fi
|
||||
@ -66,7 +66,7 @@ start() {
|
||||
|
||||
count=0
|
||||
while true; do
|
||||
if [[ -e /dev/$modem ]] || [[ $count -gt $link_watch_timeout ]]; then
|
||||
if [[ -e /dev/$modem ]] || [[ $count -gt $LINK_WATCH_TIMEOUT ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
@ -88,7 +88,7 @@ start() {
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $count -gt $link_watch_timeout ]] || ! pidof pppd > /dev/null; then
|
||||
if [[ $count -gt $LINK_WATCH_TIMEOUT ]] || ! pidof pppd > /dev/null; then
|
||||
msg_fail
|
||||
return
|
||||
fi
|
||||
@ -96,7 +96,7 @@ start() {
|
||||
count=$(($count + 1))
|
||||
done
|
||||
|
||||
if [[ "$link_watch" == "true" ]]; then
|
||||
if [[ "$LINK_WATCH" == "true" ]]; then
|
||||
watch &
|
||||
fi
|
||||
|
||||
|
@ -26,11 +26,11 @@ watch_eth() {
|
||||
if [[ "$(cat /sys/class/net/$OS_ETH/operstate 2>/dev/null)" == "up" ]]; then
|
||||
count=0
|
||||
else
|
||||
if [[ $count -lt $link_watch_timeout ]]; then
|
||||
if [[ $count -lt $LINK_WATCH_TIMEOUT ]]; then
|
||||
count=$(($count + 5))
|
||||
logger -t ethernet -s "disconnected"
|
||||
else
|
||||
logger -t ethernet -s "disconnected for $link_watch_timeout seconds, calling panic action"
|
||||
logger -t ethernet -s "disconnected for $LINK_WATCH_TIMEOUT seconds, calling panic action"
|
||||
panic_action network
|
||||
fi
|
||||
fi
|
||||
@ -45,11 +45,11 @@ watch_ip() {
|
||||
if ip addr show dev $iface | grep inet &>/dev/null; then
|
||||
count=0
|
||||
else
|
||||
if [[ $count -lt $ip_watch_timeout ]]; then
|
||||
if [[ $count -lt $IP_WATCH_TIMEOUT ]]; then
|
||||
count=$(($count + 5))
|
||||
logger -t network -s "$iface has no IP address"
|
||||
else
|
||||
logger -t network -s "$iface had no IP address for $ip_watch_timeout seconds, calling panic action"
|
||||
logger -t network -s "$iface had no IP address for $IP_WATCH_TIMEOUT seconds, calling panic action"
|
||||
panic_action network
|
||||
fi
|
||||
fi
|
||||
@ -85,7 +85,7 @@ start_wlan() {
|
||||
dhclient -cf "$DH_CONF" $OS_WLAN
|
||||
fi
|
||||
|
||||
if [[ "$ip_watch" == "true" ]] && ip addr show dev $OS_WLAN | grep inet &>/dev/null; then
|
||||
if [[ "$IP_WATCH" == "true" ]] && ip addr show dev $OS_WLAN | grep inet &>/dev/null; then
|
||||
watch_ip $OS_WLAN &
|
||||
fi
|
||||
}
|
||||
@ -121,7 +121,7 @@ start_eth() {
|
||||
done
|
||||
|
||||
# wait for link
|
||||
test "$link_watch" == "true" || LINK_NEGO_TIMEOUT=5
|
||||
test "$LINK_WATCH" == "true" || LINK_NEGO_TIMEOUT=5
|
||||
count=0
|
||||
while [[ "$(cat /sys/class/net/$OS_ETH/carrier 2>&1)" != "1" ]]; do
|
||||
sleep 1
|
||||
@ -145,11 +145,11 @@ start_eth() {
|
||||
dhclient -cf "$DH_CONF" $OS_ETH
|
||||
fi
|
||||
|
||||
if [[ "$link_watch" == "true" ]]; then
|
||||
if [[ "$LINK_WATCH" == "true" ]]; then
|
||||
watch_eth &
|
||||
fi
|
||||
|
||||
if [[ "$ip_watch" == "true" ]] && ip addr show dev $OS_ETH | grep inet &>/dev/null; then
|
||||
if [[ "$IP_WATCH" == "true" ]] && ip addr show dev $OS_ETH | grep inet &>/dev/null; then
|
||||
watch_ip $OS_ETH &
|
||||
fi
|
||||
}
|
||||
@ -175,7 +175,7 @@ start() {
|
||||
fi
|
||||
|
||||
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"
|
||||
panic_action network
|
||||
return 1
|
||||
|
@ -8,7 +8,7 @@ NETWATCH_INTERVAL=20
|
||||
|
||||
test -f $WATCH_CONF && source $WATCH_CONF || exit 0
|
||||
|
||||
if [[ -z "$netwatch_host" || -z "$netwatch_port" ]]; then
|
||||
if [[ -z "$NETWATCH_HOST" || -z "$NETWATCH_PORT" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -22,15 +22,15 @@ watch() {
|
||||
NETWATCH_RETRIES=$(($NETWATCH_RETRIES - 1))
|
||||
while true; do
|
||||
sleep $NETWATCH_INTERVAL
|
||||
if nc -z -w $NETWATCH_TIMEOUT $netwatch_host $netwatch_port </dev/null >/dev/null 2>&1; then
|
||||
if nc -z -w $NETWATCH_TIMEOUT $NETWATCH_HOST $NETWATCH_PORT </dev/null >/dev/null 2>&1; then
|
||||
count=0
|
||||
else
|
||||
if [[ $count -lt $NETWATCH_RETRIES ]]; then
|
||||
logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port"
|
||||
logger -t netwatch -s "cannot connect to $NETWATCH_HOST:$NETWATCH_PORT"
|
||||
count=$(($count + 1))
|
||||
continue
|
||||
else
|
||||
logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port, calling panic action"
|
||||
logger -t netwatch -s "cannot connect to $NETWATCH_HOST:$NETWATCH_PORT, calling panic action"
|
||||
panic_action netwatch
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user