diff options
Diffstat (limited to 'network/pdnsd/rc.pdnsd')
-rw-r--r-- | network/pdnsd/rc.pdnsd | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/network/pdnsd/rc.pdnsd b/network/pdnsd/rc.pdnsd new file mode 100644 index 0000000000..64115e1cb5 --- /dev/null +++ b/network/pdnsd/rc.pdnsd @@ -0,0 +1,78 @@ +#!/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 |