tags 448006 patch
thanks

attached is a patch that adds a lsb header and a status action.

thanks,
stew
diff -ruN bind9-9.4.1-P1.orig/debian/bind9.init bind9-9.4.1-P1/debian/bind9.init
--- bind9-9.4.1-P1.orig/debian/bind9.init	2007-11-17 06:07:43.000000000 -0500
+++ bind9-9.4.1-P1/debian/bind9.init	2007-11-17 06:43:16.000000000 -0500
@@ -1,4 +1,16 @@
 #!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          named
+# Required-Start:    $syslog $local_fs $remote_fs $network
+# Required-Stop:     $syslog $local_fs $remote_fs $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start and stop bind9
+# Description:       bind9 is a Domain Name Server (DNS)
+#        which translates ip addresses to and from internet names
+### END INIT INFO
+#
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
@@ -6,6 +18,7 @@
 # Don't modify this line, change or create /etc/default/bind9.
 OPTIONS=""
 RESOLVCONF=yes
+PIDFILE=/var/run/bind/run/named.pid
 
 test -f /etc/default/bind9 && . /etc/default/bind9
 
@@ -45,7 +58,7 @@
 	fi
 
 	if start-stop-daemon --start --quiet --exec /usr/sbin/named \
-		--pidfile /var/run/bind/run/named.pid -- $OPTIONS; then
+		--pidfile $PIDFILE -- $OPTIONS; then
 	    if [ "X$RESOLVCONF" != "Xno" ] && [ -x /sbin/resolvconf ] ; then
 		echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.named
 	    fi
@@ -90,6 +103,21 @@
 	$0 start
     ;;
     
+    status)
+	if start-stop-daemon --stop --signal 0 --quiet --pid $PIDFILE >/dev/null; then
+	    log_success_msg "bind is running"
+	    exit 0
+	else
+	    if [ -e "$PIDFILE" ]; then
+		log_failure_msg "bind has failed"
+		exit 1
+	    else
+		log_failure_msg "bind is not running"
+		exit 3
+	    fi
+	fi
+    ;;
+
     *)
 	log_action_msg "Usage: /etc/init.d/bind9 {start|stop|reload|restart|force-reload}"
 	exit 1

Attachment: signature.asc
Description: Digital signature

Reply via email to