slackbuilds_ponce/network/nsd/rc.nsd
Robby Workman 1523e52ef6
network/nsd: Create piddir during init
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2021-07-19 16:23:33 +07:00

52 lines
704 B
Bash

#!/bin/sh
#
# Start/stop/restart nsd
#
do_start() {
if [ -x /usr/sbin/nsd ]; then
echo "Starting Name Server Daemon: /usr/sbin/nsd"
mkdir -p /var/run/nsd
chown nsd:nsd /var/run/nsd
/usr/sbin/nsd -c /etc/nsd/nsd.conf 2> /dev/null
fi
}
do_stop() {
echo "Stopping Name Server Daemon"
kill $(cat /var/run/nsd/nsd.pid) 2> /dev/null
}
do_restart() {
do_stop
sleep 1
do_start
}
do_reload() {
kill -HUP $(cat /var/run/nsd/nsd.pid)
}
do_logreopen() {
do_reload
}
case "$1" in
'start')
do_start
;;
'stop')
do_stop
;;
'restart')
do_restart
;;
'reload')
do_reload
;;
'logreopen')
do_logreopen
;;
*)
echo "usage $0 start|stop|restart|reload|logreopen"
esac