ports/152331: [PATCH] dns/nsd improve rc script
Philippe Pepiot
phil at philpep.org
Wed Nov 17 14:20:11 UTC 2010
>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 at 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:
More information about the freebsd-ports-bugs
mailing list