#!/bin/sh # chkconfig: 35 98 10 # description: blackhole UDP proxy for DNS # processname: blackhole # pidfile: /var/run/blackhole.pid cd / PIDFILE=/var/run/udpproxy.pid SUBSYS=/var/lock/subsys/udpproxy NAME=udpproxy OPTIONFILE=/etc/udpproxy-options.conf case "$1" in start) if [ ! -f $OPTIONFILE ] ; then echo $OPTIONFILE does not exist echo exiting exit 1 fi OPTIONS= . $OPTIONFILE if [ "$OPTIONS" = "" ];then echo OPTIONS not defined in $OPTIONFILE echo exiting exit 1 fi echo -n "Starting $NAME: " /usr/sbin/$NAME --daemon $OPTIONS echo $NAME touch $SUBSYS ;; stop) echo -n "Stopping $NAME: " if [ -f $PIDFILE ] ; then kill `cat $PIDFILE` rm -f $SUBSYS rm -f $PIDFILE echo "$NAME" else echo fi ;; restart) $0 stop sleep 5 $0 start ;; reload) echo Nothing to reload ;; status) if [ ! -f $PIDFILE ] ; then echo Service $NAME is not running elif ! kill -0 `cat $PIDFILE` ; then echo Service $NAME is not running echo Unclean shutdown else echo Service $NAME is running fi ;; *) echo "Usage: $NAME {start|stop|restart|reload|status}" exit 1 esac exit 0