#!/bin/sh
### BEGIN INIT INFO
# Provides: gdnsd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: gdnsd
# Description: authoritative name server
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/gdnsd
GDNSDCTL=/usr/bin/gdnsdctl
NAME="gdnsd"
PIDFILE=/var/run/$NAME.pid
USER="gdnsd"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
[ -f /etc/default/$NAME ] && . /etc/default/$NAME
gdnsd_cmd() {
case "$1" in
start)
start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON --user $USER -- -l daemonize
;;
stop)
start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $GDNSDCTL -- -l stop
rm -f $PIDFILE
;;
reload)
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --exec $GDNSDCTL -- -l replace
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
esac
}
case "$1" in
start|stop|reload|restart)
log_daemon_msg "$1ing $NAME" "$NAME"
gdnsd_cmd "$1"
log_end_msg $?
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/gdnsd {start|stop|reload|restart|status}"
exit 1
esac
exit 0