How to restart dhcpd?
-
Running a Captive Portal for a library. They want access turned off after hours. If I use cron to set LAN interface to down, sometimes the DHCP server stops. I can issue the start command via cron:
/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /var/dhcpd/etc/dhcpd.conf vr0
but sometimes dhcpd is already running. Is there a restart option or script?
Thanks
-
I'm not the most qualify person to sugest this, but why don't you invoke stop dhcpd first and then start it?
-
Just use a different approach!
At Firewall | Schedules create surftimes or off-times and apply them to allow or deny rules.
This way traffic gets blocked by a rule and not because an IF is down. Solves your problems with the DHCP server instantly. -
The scheduled rules approach should work.
That said, if you want to continue using your cron method your best option is to killall -9 dhcpd before restarting it, that way it won't ever be running when you run it from cron.