]> git.pld-linux.org Git - packages/pdnsd.git/commitdiff
- rewrited.
authorkloczek <kloczek@pld-linux.org>
Thu, 8 Feb 2001 03:30:02 +0000 (03:30 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    pdnsd.init -> 1.2

pdnsd.init

index fe43533b400589a265ed433e3a27ca798245ce90..7ca41f8f315ec3285fac11fde4f8ada9bfddfe01 100644 (file)
@@ -1,53 +1,87 @@
-#!/bin/bash
+#!/bin/sh
 #
-# $Id$
+# pdns         Proxy DNS Daemon
 #
-#      /etc/rc.d/init.d/pdnsd
+# chkconfig:   345 87 14
 #
-# Starts the Proxy DNS Daemon
-#
-# tested on Redhat 6.1 should work on 5.0+
-# chkconfig: 345 87 14
-# description: Proxy DNS Daemon
+# description: Proxy DNS Daemon
 #
 
-# Source function library.
+# Source function library
 . /etc/rc.d/init.d/functions
 
-test -x /usr/sbin/pdnsd || exit 0
+# Get network config
+. /etc/sysconfig/network
 
-RETVAL=0
+# Get service config - may override defaults
+[ -f /etc/sysconfig/pdnsd ] && . /etc/sysconfig/pdnsd
+
+# Check that networking is up.
+if is_no "${NETWORKING}"; then
+       msg_Network_Down Pdnsd
+       exit 1
+fi
+
+test -x /usr/sbin/pdnsd || exit 0
 
-#
-#      See how we were called.
-#
 case "$1" in
-  start)
-       echo -n 'Starting pdnsd: '
-       daemon /usr/sbin/pdnsd -d
-       RETVAL=$? 
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdnsd
-       echo
-       ;;
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/pdns ]; then
+               msg_starting Pdns
+               daemon pdnsd
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdns
+       else
+               msg_Already_Running Pdns
+               exit 1
+       fi
+        ;;
   stop)
-       echo -n 'Shutting down pdnsd: '
-       killproc pdnsd 
-       RETVAL=$? 
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pdnsd
-       echo
+        # Stop daemons.
+        # show "Stopping %s service" pdns
+       if [ -f /var/lock/subsys/syslogd ]; then
+               msg_stopping Pdns
+               killproc pdnsd
+               rm -f /var/lock/subsys/pdns >/dev/null 2>&1
+       else
+               msg_Not_Running Pdns
+               exit 1
+       fi      
+        ;;
+  restart)
+        $0 stop
+       $0 start
+        ;;
+  reload)
+       if [ -f /var/lock/subsys/pdns ]; then
+               msg_show Pdns
+               msg_reload
+               busy
+               killproc pdnsd -HUP
+               deltext
+               ok              
+       else
+               msg_Not_Running Pdns
+               exit 1
+       fi
        ;;
-  status)
-    status pdnsd
-       exit $?
+  force-reload)
+       # if program allows reloading without stopping
+       $0 reload
+       exit $?
+
+       # or if it doesn't
+       $0 stop && $0 start
+       exit $?
        ;;
-  reload|restart)
-       $0 stop
-       $0 start
-       RETVAL=$?
-       ;;
+  status)
+       status pdnsd
+       exit $?
+        ;;
   *)
-       echo "Usage: /etc/rc.d/init.d/pdnsd {start|stop|status|restart|reload}"
-       exit 1
+        # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
+       msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
+        exit 1
 esac
 
 exit $RETVAL
This page took 0.044 seconds and 4 git commands to generate.