#!/bin/sh # $Id: pdnsd.init,v 1.2 2003/01/27 00:28:58 at Exp $ # # /etc/init.d/pdnsd # Init file for pdnsd server # # chkconfig: 2345 20 80 # description: a caching dns proxy for small networks or dialin accounts # processname: pdnsd # config: /etc/pdnsd.conf # pidfile: /var/run/pdnsd.pid DAEMON=/usr/sbin/pdnsd CONFIGFILE=/etc/pdnsd.conf LOCKFILE=/var/lock/subsys/pdnsd PIDFILE=/var/run/pdnsd.pid RETVAL=0 # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. SourceIfNotEmpty /etc/sysconfig/network && [ "$NETWORKING" != no ] && [ -x $DAEMON ] && [ -s $CONFIGFILE ] || exit start() { echo -n "Starting pdnsd: " daemon "$DAEMON" -d -c "$CONFIGFILE" -p "$PIDFILE" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch "$LOCKFILE" return $RETVAL } stop() { echo -n "Shutting down pdnsd: " killproc "$DAEMON" echo RETVAL=$? [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" return $RETVAL } restart() { stop [ $RETVAL -eq 0 ] && sleep 2 start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; status) status "$DAEMON" RETVAL=$? ;; *) echo "Usage: ${0##*/} {start|stop|restart|reload|condstop|condrestart|status}" RETVAL=1 ;; esac exit $RETVAL