Extend check_gateway script

ensure that dhcp server is stopped or started depending on gw mode
This commit is contained in:
ohrensessel 2014-10-01 23:52:02 +02:00
parent 30e221a63f
commit 6ec13b343f

View file

@ -31,4 +31,21 @@ OLD_STATE="$(cat $MESH/gw_mode)"
# Restart DHCP server
/usr/sbin/service isc-dhcp-server start
fi
exit 0
done
if [ "$NEW_STATE" == "server" ]; then
/usr/sbin/service isc-dhcp-server status 2>&1> /dev/null
if [[ $? -ne 0 ]]
then
/usr/sbin/service isc-dhcp-server restart
fi
fi
if [ "$NEW_STATE" == "off" ]; then
/usr/sbin/service isc-dhcp-server status 2>&1> /dev/null
if [[ $? -eq 0 ]]
then
/usr/sbin/service isc-dhcp-server stop
fi
fi