"wlanwatchdog.sh" re-fix missing ';' and fix indentation

This commit is contained in:
Marc René Schädler 2013-11-18 07:56:02 +01:00
parent 6f1b52d393
commit e2cdbae554
1 changed files with 24 additions and 29 deletions

View File

@ -92,7 +92,7 @@ count_clients() {
}
count_neighbours() {
count_originators "$WLAN_MESH_INTERFACE"
count_originators "$WLAN_MESH_INTERFACE"
}
scan_wlan() {
@ -106,7 +106,7 @@ scan_wlan() {
}
fsm_load() {
if [ -f "$STATEFILE" ] then
if [ -f "$STATEFILE" ]; then
STATE=""
SINCE=""
. "$STATEFILE" || return 1
@ -124,11 +124,11 @@ fsm_entry() {
scan_wlan
;;
error)
if [ -n "$DEBUG" ] && [ $DEBUG -eq 1 ]; then
debug_output | gzip > ${DEBUGFILE}
fi
reboot
;;
if [ -n "$DEBUG" ] && [ $DEBUG -eq 1 ]; then
debug_output | gzip > ${DEBUGFILE}
fi
reboot
;;
esac
}
@ -138,33 +138,28 @@ fsm_transition() {
local OLDSTATE=$STATE
case $STATE in
working)
if [ $(count_neighbours) -eq 0 ] && [ $(count_clients) -eq 0 ] then
STATE=pending
fi
;;
pending)
if [ $AGE -ge $TIMEOUT_MEDIUM ] then
STATE=error
elif [ $(count_originators) -eq 0 ] && [ $AGE -ge $TIMEOUT_SHORT ]
then
STATE=error
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]
then
if [ $(count_neighbours) -eq 0 ] && [ $(count_clients) -eq 0 ]; then
STATE=pending
fi
;;
pending)
if [ $AGE -ge $TIMEOUT_MEDIUM ]; then
STATE=error
elif [ $(count_originators) -eq 0 ] && [ $AGE -ge $TIMEOUT_SHORT ]; then
STATE=error
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]; then
STATE=working
fi
;;
*)
if [ $AGE -ge $TIMEOUT_LONG ]
then
STATE=error
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]
then
STATE=working
fi
;;
if [ $AGE -ge $TIMEOUT_LONG ]; then
STATE=error
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]; then
STATE=working
fi
;;
esac
if [ ! "$OLDSTATE" == "$STATE" ]
then
if [ ! "$OLDSTATE" == "$STATE" ]; then
echo "$(date) '$OLDSTATE' -> '$STATE'"
fsm_entry
fi