forked from freifunk-franken/firmware
"wlanwatchdog.sh" re-fix missing ';' and fix indentation
This commit is contained in:
parent
6f1b52d393
commit
e2cdbae554
|
@ -92,7 +92,7 @@ count_clients() {
|
||||||
}
|
}
|
||||||
|
|
||||||
count_neighbours() {
|
count_neighbours() {
|
||||||
count_originators "$WLAN_MESH_INTERFACE"
|
count_originators "$WLAN_MESH_INTERFACE"
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_wlan() {
|
scan_wlan() {
|
||||||
|
@ -106,7 +106,7 @@ scan_wlan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fsm_load() {
|
fsm_load() {
|
||||||
if [ -f "$STATEFILE" ] then
|
if [ -f "$STATEFILE" ]; then
|
||||||
STATE=""
|
STATE=""
|
||||||
SINCE=""
|
SINCE=""
|
||||||
. "$STATEFILE" || return 1
|
. "$STATEFILE" || return 1
|
||||||
|
@ -124,11 +124,11 @@ fsm_entry() {
|
||||||
scan_wlan
|
scan_wlan
|
||||||
;;
|
;;
|
||||||
error)
|
error)
|
||||||
if [ -n "$DEBUG" ] && [ $DEBUG -eq 1 ]; then
|
if [ -n "$DEBUG" ] && [ $DEBUG -eq 1 ]; then
|
||||||
debug_output | gzip > ${DEBUGFILE}
|
debug_output | gzip > ${DEBUGFILE}
|
||||||
fi
|
fi
|
||||||
reboot
|
reboot
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,33 +138,28 @@ fsm_transition() {
|
||||||
local OLDSTATE=$STATE
|
local OLDSTATE=$STATE
|
||||||
case $STATE in
|
case $STATE in
|
||||||
working)
|
working)
|
||||||
if [ $(count_neighbours) -eq 0 ] && [ $(count_clients) -eq 0 ] then
|
if [ $(count_neighbours) -eq 0 ] && [ $(count_clients) -eq 0 ]; then
|
||||||
STATE=pending
|
STATE=pending
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
pending)
|
pending)
|
||||||
if [ $AGE -ge $TIMEOUT_MEDIUM ] then
|
if [ $AGE -ge $TIMEOUT_MEDIUM ]; then
|
||||||
STATE=error
|
STATE=error
|
||||||
elif [ $(count_originators) -eq 0 ] && [ $AGE -ge $TIMEOUT_SHORT ]
|
elif [ $(count_originators) -eq 0 ] && [ $AGE -ge $TIMEOUT_SHORT ]; then
|
||||||
then
|
STATE=error
|
||||||
STATE=error
|
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]; then
|
||||||
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]
|
|
||||||
then
|
|
||||||
STATE=working
|
STATE=working
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ $AGE -ge $TIMEOUT_LONG ]
|
if [ $AGE -ge $TIMEOUT_LONG ]; then
|
||||||
then
|
STATE=error
|
||||||
STATE=error
|
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]; then
|
||||||
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]
|
STATE=working
|
||||||
then
|
fi
|
||||||
STATE=working
|
;;
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
if [ ! "$OLDSTATE" == "$STATE" ]
|
if [ ! "$OLDSTATE" == "$STATE" ]; then
|
||||||
then
|
|
||||||
echo "$(date) '$OLDSTATE' -> '$STATE'"
|
echo "$(date) '$OLDSTATE' -> '$STATE'"
|
||||||
fsm_entry
|
fsm_entry
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue