slackbuilds_ponce/network/pdnsd/rc.pdnsd
2010-05-12 23:32:39 +02:00

78 lines
1.4 KiB
Bash

#!/bin/bash
#
# /etc/rc.d/rc.pdnsd
#
# Starts the Proxy DNS Daemon
#
# description: Proxy DNS Daemon
# processname: pdnsd
# config: /etc/pdnsd.conf
# distribution: Slackware
# author: André Geraldo Vieira <andre.geraldo@gmail.com>
#
# Additional info:
# 1) put these lines in the /etc/rc.d/rc.local:
# if [ -x /etc/rc.d/rc.pdnsd ]; then
# /etc/rc.d/rc.pdnsd start
# fi
#
# 2) put these lines in the /etc/rc.d/rc.local_shutdown:
# if [ -x /etc/rc.d/rc.pdnsd ]; then
# /etc/rc.d/rc.pdnsd stop
# fi
start() {
if ! [ -r /var/run/pdnsd.pid ]; then
echo -n 'Starting pdnsd...'
/usr/sbin/pdnsd -d -p /var/run/pdnsd.pid
echo 'OK'
else
echo 'The PDNSD is already running!'
fi
}
stop() {
if [ -r /var/run/pdnsd.pid ]; then
echo -n "Shutting down pdnsd... "
kill -15 `cat /var/run/pdnsd.pid` && rm -f /var/run/pdnsd.pid 2> /dev/null
echo ' OK'
else
echo 'The PDNSD already stopped!'
fi
}
restart() {
stop
sleep 3
start
}
status() {
if [ -r /var/run/pdnsd.pid ]; then
pid=`cat /var/run/pdnsd.pid`
echo "PDNSD (pid $pid) is running."
else
echo 'PDNSD is stopped.'
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
;;
esac
exit 0
#EOF