-#!/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