Andrew Reilly
2009-Jan-15 01:09 UTC
How to get djbdns to start early enough to satisfy ntpd at boot?
Hi there, I've been a happy djbdns+tinydns user for many, many years. I want to keep using it, so answers of the form "bletch! Use ISC BIND the way BSD intended" will be ignored :-) Having said that, one annoying consequence of my transition some time ago to using ntpd, rather than just setting the clock once-off with ntpdate as I used to, is that the /etc/rc.d mechanism starts ntpd before /usr/local/etc/rc.d/svscan.sh starts svscan, which starts /services/dnscache. That wouldn't matter if ntpd was a bit sensible and just kept trying to find its nomminated servers, but it gives up and just sits there not synchronising time from any reference. So I have to remember to manually "/etc/rc.d/ntpd restart" every time I reboot. So: does anyone know how to modify the boot-time order so that svscan starts at (or before) the point in the boot cycle where BIND would, on other systems? I suspect that it should be possible by changing the PROVIDE: in svscan.sh to include one of the things REQUIRE:'d by ntpd. Or perhaps the REQUIRE: LOGIN in svscan.sh is incompatible with the BEFORE: LOGIN in ntpd? Has any other user of dnscache encountered and solved this problem? Cheers, Andrew
Oliver Fromme
2009-Jan-15 03:48 UTC
How to get djbdns to start early enough to satisfy ntpd at boot?
Andrew Reilly wrote: > So: does anyone know how to modify the boot-time order so that > svscan starts at (or before) the point in the boot cycle where > BIND would, on other systems? I suspect that it should be > possible by changing the PROVIDE: in svscan.sh to include one of > the things REQUIRE:'d by ntpd. Or perhaps the REQUIRE: LOGIN in > svscan.sh is incompatible with the BEFORE: LOGIN in ntpd? I think "BEFORE: ntpd" should be sufficient. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Gesch?ftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M?n- chen, HRB 125758, Gesch?ftsf?hrer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "Unix gives you just enough rope to hang yourself -- and then a couple of more feet, just to be sure." -- Eric Allman
Ben Morrow
2009-Jan-15 04:00 UTC
How to get djbdns to start early enough to satisfy ntpd at boot?
Quoth Andrew Reilly <andrew-freebsd@areilly.bpc-users.org>:> > So: does anyone know how to modify the boot-time order so that > svscan starts at (or before) the point in the boot cycle where > BIND would, on other systems? I suspect that it should be > possible by changing the PROVIDE: in svscan.sh to include one of > the things REQUIRE:'d by ntpd. Or perhaps the REQUIRE: LOGIN in > svscan.sh is incompatible with the BEFORE: LOGIN in ntpd? > > Has any other user of dnscache encountered and solved this > problem?I have, in my svscan.sh, # PROVIDE: svscan # REQUIRE: SERVERS cleanvar and I also have a /usr/local/etc/rc.d/dnscache which looks like #!/bin/sh # PROVIDE: named # REQUIRE: svscan . /etc/rc.subr . /usr/local/etc/svc.subr name="dnscache" rcvar=`set_rcvar` : ${dnscache_enable:="NO"} load_rc_config $name load_svc_subr_config run_rc_command "$1" and a /usr/local/etc/svc.subr as attached. It's somewhat more general than is needed for dnscache, as I also use it to start qmail. Basically: the PROVIDE: named line is needed to get dnscache up before ntpd, and the REQUIRE: LOGIN line needs to be changed. Ben -------------- next part -------------- # # Subroutines for handling services under the control of svscan(8). # Requires rc.subr is loaded first. # load_svc_subr_config () { load_rc_config_var svscan svscan_servicedir : ${svscan_servicedir:=/var/service} : ${svc:=/usr/local/bin/svc} : ${svok:=/usr/local/bin/svok} : ${svstat:=/usr/local/bin/svstat} : ${svcname:=${name}} : ${service_dir:=${svscan_servicedir}/${svcname}} : ${svok_timeout:=30} : ${svstat_timeout:=30} : ${start_cmd:=svc_subr_start} : ${stop_cmd:=svc_subr_stop} : ${restart_cmd:=svc_subr_restart} : ${extra_commands:="status reload flush"} : ${status_cmd:=svc_subr_status} : ${reload_cmd:=svc_subr_reload} : ${flush_cmd:=svc_subr_flush} } svc_subr_isup () { $svstat $1 | grep -q ": up" } svc_subr_isdown () { $svstat $1 | grep -q ": down" } svc_subr_waitfor () { local n check timeout err check="$1" timeout=$2 err="$3" n=0 while [ $n -lt $timeout ] && ! $check $service_dir do sleep 1 n=$(( n + 1 )) done if ! $check $service_dir then echo "$err" >&2 exit 1 fi } svc_subr_start () { echo -n "Checking ${name} is up" svc_subr_waitfor $svok $svok_timeout \ "supervise is not running in ${service_dir}!" $svc -u $service_dir svc_subr_waitfor svc_subr_isup $svstat_timeout \ "${service_dir} won't come up!" echo "." } svc_subr_stop () { echo -n "Bringing ${name} down" $svc -d $service_dir svc_subr_waitfor svc_subr_isdown $svstat_timeout \ "${service_dir} won't come down, trying SIGKILL" svc -k $service_dir svc_subr_waitfor svc_subr_isdown $svstat_timeout \ "${service_dir} won't come down!" echo "." } svc_subr_restart () { echo -n "Sending ${name} a SIGTERM" $svc -t $service_dir echo "." } svc_subr_reload () { echo -n "Sending ${name} a SIGHUP" $svc -h $service_dir echo "." } svc_subr_flush () { echo -n "Sending ${name} a SIGALRM" $svc -a $service_dir echo "." } svc_subr_status () { $svstat $service_dir }
Maxim Khitrov
2009-Jan-15 04:46 UTC
How to get djbdns to start early enough to satisfy ntpd at boot?
On Thu, Jan 15, 2009 at 12:14 AM, Andrew Reilly <andrew-freebsd@areilly.bpc-users.org> wrote:> Hi there, > > I've been a happy djbdns+tinydns user for many, many years. I > want to keep using it, so answers of the form "bletch! Use ISC > BIND the way BSD intended" will be ignored :-) > > Having said that, one annoying consequence of my transition > some time ago to using ntpd, rather than just setting the clock > once-off with ntpdate as I used to, is that the /etc/rc.d > mechanism starts ntpd before /usr/local/etc/rc.d/svscan.sh > starts svscan, which starts /services/dnscache. That wouldn't > matter if ntpd was a bit sensible and just kept trying to find > its nomminated servers, but it gives up and just sits there not > synchronising time from any reference. So I have to remember to > manually "/etc/rc.d/ntpd restart" every time I reboot. > > So: does anyone know how to modify the boot-time order so that > svscan starts at (or before) the point in the boot cycle where > BIND would, on other systems? I suspect that it should be > possible by changing the PROVIDE: in svscan.sh to include one of > the things REQUIRE:'d by ntpd. Or perhaps the REQUIRE: LOGIN in > svscan.sh is incompatible with the BEFORE: LOGIN in ntpd? > > Has any other user of dnscache encountered and solved this > problem? >I use the following in svscan.sh, no problems with ntpdate or any other service: # PROVIDE: svscan # REQUIRE: FILESYSTEMS netif pf # BEFORE: routing - Max
Jan Mikkelsen
2009-Jan-15 05:47 UTC
How to get djbdns to start early enough to satisfy ntpd at boot?
Hi, Andrew Reilly wrote:> I've been a happy djbdns+tinydns user for many, many years. I > want to keep using it, so answers of the form "bletch! Use ISC > BIND the way BSD intended" will be ignored :-)... Well, the other alternative is to ditch ntpd and go to clockspeed the way djb intended ... Regards, Jan :-)
Brian Reichert
2009-Feb-03 15:53 UTC
How to get djbdns to start early enough to satisfy ntpd at boot?
On Fri, Jan 16, 2009 at 12:23:18AM +1100, Jan Mikkelsen wrote:> Well, the other alternative is to ditch ntpd and go to clockspeed the way > djb intended ...Or, patch ntpd's scripts to be driven by daemontools; something I've been planning on myself... (Yes, late reply, sorry...)> Regards, > > Jan-- Brian Reichert <reichert@numachi.com> 55 Crystal Ave. #286 Daytime number: (603) 434-6842 Derry NH 03038-1725 USA BSD admin/developer at large