# Get network config
. /etc/sysconfig/network
+# Default parameters
+STATUS="--status"
+DEBUG="--debug"
+VERBOSE="-v2"
+
# 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
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down Pdnsd
+ exit 1
+ fi
+else
+ exit 0
fi
test -x /usr/sbin/pdnsd || exit 0
+RETVAL=0
case "$1" in
start)
# Check if the service is already running?
if [ ! -f /var/lock/subsys/pdns ]; then
msg_starting Pdns
- daemon pdnsd --daemon
+ daemon pdnsd --daemon $STATUS $DEBUG $VERBOSE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdns
else
- msg_Already_Running Pdns
- exit 1
+ msg_already_running Pdns
fi
;;
stop)
- # Stop daemons.
- # show "Stopping %s service" pdns
if [ -f /var/lock/subsys/pdns ]; then
-
-# 1. killproc causes pdnsd not to save cache file on exit.
-# The only signals not doing this are 4, 6, 8 and 11.
-# These signals terminate this script anyway.
-# 2. killproc tries to kill all found processes. In this
-# case they are connected and die together, so doing
-# this will print errors on screen.
-
-# msg_stopping Pdns
-# killproc pdnsd
-
- echo "Stopping Pdns service"
-
+ # Stop daemons.
+ # show "Stopping %s service" pdns
+ msg_stopping Pdns
+ killproc pdnsd
rm -f /var/lock/subsys/pdns >/dev/null 2>&1
-
- killall -FPE pdnsd
-
else
- msg_Not_Running Pdns
- exit 1
- fi
+ msg_not_running Pdns
+ fi
;;
restart)
- echo "Due to a pdnsd bug you must start it manually."
$0 stop
+ $0 start
+ exit $?
;;
- reload)
+ reload|force-reload)
if [ -f /var/lock/subsys/pdns ]; then
- msg_show Pdns
- msg_reload
- busy
+ msg_reloading Pdns
killproc pdnsd -HUP
- deltext
- ok
+ RETVAL=$?
else
- msg_Not_Running Pdns
- exit 1
+ msg_not_running Pdns >&2
+ exit 7
fi
;;
- force-reload)
- # if program allows reloading without stopping
- $0 reload
- exit $?
-
- # or if it doesn't
- $0 restart
- exit $?
- ;;
status)
status pdnsd
exit $?
;;
*)
- # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
- msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
- exit 1
+ # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ exit 3
esac
exit $RETVAL