Check multiple rounds if neighbors are available before kicking. This
should reduce unneeded reboots.
Signed-off-by: Nick Hainke <vincent@systemli.org>
INTERFACES="$*"
ACTIVE=0
+NO_NEIGHBORS_COUNT=0
+MIN_KICK=5
log() {
local msg="$1"
no_neighbors() {
log "No Neighbors Available!"
+ NO_NEIGHBORS_COUNT=$(($NO_NEIGHBORS_COUNT+1))
+
if [ $ACTIVE -eq 0 ]; then
return 0
fi
write_logs
fi
- if [ $USE_WATCHDOG -eq 0 ]; then
+ if [ $USE_WATCHDOG -eq 0 ] && [ $NO_NEIGHBORS_COUNT -gt $MIN_KICK ]; then
reboot_now
fi
}
neighbors() {
ACTIVE=1
+ NO_NEIGHBORS_COUNT=0
if [ $USE_WATCHDOG -eq 1 ]; then
echo 1 >&3
fi