]> git.pld-linux.org Git - packages/pdns.git/blobdiff - pdns.init
- rel 2
[packages/pdns.git] / pdns.init
index df9b67273b583cb677297dd8e2663751c19a6a3c..87965ed789a41eb819df07b432cd69ec601fa1c2 100644 (file)
--- a/pdns.init
+++ b/pdns.init
@@ -1,7 +1,7 @@
 #!/bin/sh
 # pdns         This is controller stript for PowerDNS name server.
 #
-# chkconfig:   345 80 75
+# chkconfig:   345 85 15
 #
 # description: pdns is is a Domain Name Server (DNS) \
 #              that is used to resolve host names to IP addresses.
@@ -14,7 +14,7 @@
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
-       if [ ! -f /var/lock/subsys/network ]; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
                msg_network_down "PowerDNS"
                exit 1
        fi
@@ -28,8 +28,7 @@ SOCKETPATH=/var/run
 
 cd /var/run
 suffix=`basename $0 | awk -F- '{print $2}'`
-if [ $suffix ] 
-then
+if [ $suffix ]; then
        EXTRAOPTS=--config-name=$suffix
        PROGNAME=pdns-$suffix
 else
@@ -39,33 +38,33 @@ fi
 pdns_server="/usr/sbin/pdns_server $EXTRAOPTS"
 
 doPC() {
-       ret=$(/usr/sbin/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
+       ret=$(/usr/bin/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
 }
 
 doPC ping
 NOTRUNNING=$?
 
-
+RETVAL=0
 case "$1" in
   status)
        status pdns_server
        exit $?
-       ;;      
+       ;;
   stop)
-       if test "$NOTRUNNING" = "0"; then 
+       if test "$NOTRUNNING" = "0"; then
                msg_stopping "PowerDNS"
                doPC quit 2>&1 >/dev/null
                [ $? -eq 0 ] && ok || fail
                rm /var/lock/subsys/pdns
        else
                msg_not_running "PowerDNS"
-       fi 
-       ;;              
+       fi
+       ;;
   force-stop)
        run_cmd "Killing PowerDNS without grace" killall -v -9 pdns_server
        ;;
   start)
-       if test "$NOTRUNNING" = "0"; then 
+       if test "$NOTRUNNING" = "0"; then
                msg_already_running "PowerDNS"
        else
                msg_starting "PowerDNS (Powered DNS server)"
@@ -80,50 +79,55 @@ case "$1" in
        $0 start
        exit $?
        ;;
-  reload|force-reload) 
-       if test "$NOTRUNNING" = "0"; then 
+  reload|force-reload)
+       if test "$NOTRUNNING" = "0"; then
                show "Reloading PowerDNS"
                doPC cycle 2>&1 >/dev/null
-               [ $? -eq 0 ] && ok || fail
+               if [ $? -eq 0 ]; then
+                       ok
+               else
+                       fail
+                       RETVAL=1
+               fi
        else
-               msg_not_running "PowerDNS"
-               $0 start
+               msg_not_running "PowerDNS" >&2
+               exit 7
        fi
-       ;;              
+       ;;
   monitor)
-       if test "$NOTRUNNING" = "0"; then 
+       if test "$NOTRUNNING" = "0"; then
                msg_already_running "PowerDNS"
        else
                show "PowerDNS in foreground (testing mode)"
                $pdns_server --daemon=no --guardian=no --control-console --loglevel=9
-       fi 
-       ;;              
+       fi
+       ;;
   dump)
-       if test "$NOTRUNNING" = "0"; then 
+       if test "$NOTRUNNING" = "0"; then
                doPC list
                echo $ret
        else
                msg_not_running "PowerDNS"
-       fi 
-       ;;              
+       fi
+       ;;
   show)
        if [ $# -lt 2 ]; then
                msg_usage "$0 {show|mrtg|cricket} <variable_name_from_pdns_dump>"
-               exit 1
-       fi 
-       if test "$NOTRUNNING" = "0"; then 
+               exit 2
+       fi
+       if test "$NOTRUNNING" = "0"; then
                echo -n "$2="
                doPC show $2 ; echo $ret
        else
                msg_not_running "PowerDNS"
-       fi 
-       ;;              
+       fi
+       ;;
   mrtg)
        if [ $# -lt 2 ]; then
                msg_usage "$0 {show|mrtg|cricket} <variable_name_from_pdns_dump>"
-               exit 1
-       fi 
-       if test "$NOTRUNNING" = "0"; then 
+               exit 2
+       fi
+       if test "$NOTRUNNING" = "0"; then
                doPC show $2 ; echo $ret
                if [ "$3x" != "x" ]; then
                        doPC show $3 ; echo $ret
@@ -133,22 +137,22 @@ case "$1" in
                doPC uptime ; echo $ret
                echo PowerDNS daemon
        else
-               msg_not_running "PowerDNS"
-               exit 1
-       fi 
-       ;;              
+               msg_not_running "PowerDNS" >&2
+               exit 7
+       fi
+       ;;
   cricket)
        if [ $# -lt 2 ]; then
                msg_usage "$0 {show|mrtg|cricket} <variable_name_from_pdns_dump>"
-               exit 1
-       fi 
-       if test "$NOTRUNNING" = "0"; then 
+               exit 2
+       fi
+       if test "$NOTRUNNING" = "0"; then
                doPC show $2 ; echo $ret
        else
-               msg_not_running "PowerDNS"
-               exit 1
-       fi 
-       ;;              
+               msg_not_running "PowerDNS" >&2
+               exit 7
+       fi
+       ;;
   *)
        msg_usage "$0 {start|stop|restart|reload|force-reload|status|dump|show|mrtg|cricket|monitor} [...]"
        exit 3
This page took 0.184329 seconds and 4 git commands to generate.