From owner-freebsd-stable@FreeBSD.ORG Thu Jan 15 12:00:17 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA43E10656BB for ; Thu, 15 Jan 2009 12:00:17 +0000 (UTC) (envelope-from ben@morrow.me.uk) Received: from plesk-mail01.plus.net (plesk-mail01.plus.net [212.56.83.229]) by mx1.freebsd.org (Postfix) with ESMTP id 0B6878FC24 for ; Thu, 15 Jan 2009 12:00:16 +0000 (UTC) (envelope-from ben@morrow.me.uk) Received: (qmail 31383 invoked from network); 15 Jan 2009 12:00:15 +0000 Received: from host81-141-107-54.wlms-broadband.com (HELO osiris.mauzo.dyndns.org) (81.141.107.54) by plesk-mail01.plus.net with SMTP; 15 Jan 2009 12:00:14 +0000 Received: (qmail 67128 invoked by uid 1001); 15 Jan 2009 12:00:01 -0000 Date: Thu, 15 Jan 2009 12:00:01 +0000 From: Ben Morrow To: freebsd-stable@freebsd.org Message-ID: <20090115120001.GA23934@osiris.mauzo.dyndns.org> Mail-Followup-To: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <20090115051422.GA59032@duncan.reilly.home> X-Newsgroups: gmane.os.freebsd.stable Organization: Who, me? User-Agent: Mutt/1.5.17 (2007-11-01) Subject: Re: How to get djbdns to start early enough to satisfy ntpd at boot? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 12:00:21 -0000 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Quoth Andrew Reilly : > > 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 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="svc.subr" # # 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 } --oyUTqETQ0mS9luUI--