Re: dhcp restart with bad config
- Date: Wed, 30 Aug 2017 09:32:14 +0100
- From: Liam O'Toole <liam.p.otoole@xxxxxxxxx>
- Subject: Re: dhcp restart with bad config
On 2017-08-29, Bonno Bloksma <b.bloksma@xxxxxx> wrote:
> Today I had a small (big?) problem with the DHCP server.
> When I make any changes I allways do a
> # service isc-dhcp-server restart
> to test the new config. In the past when there was an error in the config the service would keep running using the previous config.
> This was achieved by doing a config test before the service stop.
> On my old Wheezy machine the /etc/init.d/isc-dhcp-server file has the segment(s)
> if ! /usr/sbin/dhcpd -t $OPTIONS -q -cf "$DHCPD_CONF" > /dev/null 2>&1; then
> echo "dhcpd self-test failed. Please fix $DHCPD_CONF."
> echo "The error was: "
> /usr/sbin/dhcpd -t $OPTIONS -cf "$DHCPD_CONF"
> exit 1
> restart | force-reload)
> $0 stop
> sleep 2
> $0 start
> if [ "$?" != "0" ]; then
> exit 1
> Where a failed test_config will result in stopping the restart.
> On my Jessie DHCP servers this safeguard no longer seems to be present.
> After a typo in the config my DHCP server stopped and did not come up until I fixed the typo and (re)started the service. Which took a while as I got disturbed and the change was not urgent and I assumed the service was still running :-(
> Is there any way to get the old functionality back?
> Bonno Bloksma
You could port the script segments you identified to the jessie version
of the init file. But first I would consult the changelog from the
wheezy to the jessie versions (especially with regard to systemd
migration) to see if there is a better way.