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