Date: Wed, 17 Nov 2010 14:54:16 +0100 (CET) From: Philippe Pepiot <phil@philpep.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/152331: [PATCH] dns/nsd improve rc script Message-ID: <201011171354.oAHDsGGE051018@aldo.philpep.org> Resent-Message-ID: <201011171420.oAHEKAY1048871@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 152331 >Category: ports >Synopsis: [PATCH] dns/nsd improve rc script >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Nov 17 14:20:09 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Philippe Pepiot >Release: FreeBSD 8.1-RELEASE amd64 >Organization: >Environment: System: FreeBSD aldo.philpep.org 8.1-RELEASE FreeBSD 8.1-RELEASE #4: Sat Sep 11 15:23:36 UTC 2010 root@aldo.philpep.org:/usr/obj/usr/src/sys/ALDO amd64 >Description: I propose this improvement for nsd rc script. - Add status and reload commands - nsd refuse to start without database, launch nsdc rebuild if database doesn't exists - Remove sleep from stop command (I suppose nsdc patch block until finished no ?) >How-To-Repeat: >Fix: --- nsd-in.patch begins here --- diff -ru nsd.old/files/nsd.in nsd/files/nsd.in --- nsd.old/files/nsd.in 2010-11-17 14:16:38.485927069 +0100 +++ nsd/files/nsd.in 2010-11-17 14:48:26.393097953 +0100 @@ -17,24 +17,51 @@ required_files=%%PREFIX%%/etc/nsd/nsd.conf -command=%%PREFIX%%/sbin/${name} +command=%%PREFIX%%/sbin/nsdc pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile %%PREFIX%%/etc/nsd/nsd.conf` load_rc_config ${name} nsd_enable=${nsd_enable-"NO"} +extra_commands="reload" +start_precmd="nsd_precmd" +status_cmd="nsd_status" +start_cmd="nsd_start" +reload_cmd="nsd_reload" stop_cmd="nsd_stop" +nsd_precmd() +{ + db=`%%PREFIX%%/sbin/nsd-checkconf -o database %%PREFIX%%/etc/nsd/nsd.conf` + if [ ! -f "$db" ]; then + ${command} rebuild + fi +} + +nsd_status() +{ + ${command} running && echo "nsd running pid `head -n 1 ${pidfile}`" +} + +nsd_start() +{ + echo "Starting nsd." + ${command} start +} + +nsd_reload() +{ + ${command} rebuild && ${command} reload +} + nsd_stop() { echo "Merging nsd zone transfer changes to zone files." - %%PREFIX%%/sbin/nsdc patch - - sleep 5 + ${command} patch echo "Stopping nsd." - %%PREFIX%%/sbin/nsdc stop + ${command} stop } run_rc_command "$1" --- nsd-in.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011171354.oAHDsGGE051018>