#!/bin/sh # The following two lines enable chkconfig(1) to manipulate this script # chkconfig: 345 87 13 # description: Posadis is an authoritative and caching Domain Name Server. \ # It is used to map Domain names to IP numbers and other resources. # processname: posadis # config: /etc/posadisrc # pidfile: /var/posadis/pidfile ### BEGIN INIT INFO # Provides: posadis # Required-Start: $network # Required-Stop: $network # X-UnitedLinux-Should-Start: # X-UnitedLinux-Should-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Posadis is an authoritative and caching Domain Name Server, used to map Domain names to IP numbers and other resources. ### END INIT INFO POS6=posadis POS6BIN=posadis PIDFILE=/var/posadis/pidfile case "$1" in start) #start echo -n "Starting Posadis... " $POS6BIN -p $PIDFILE -f > /dev/null 2>&1 RET=$? if [ $RET != 0 ] ; then echo "failed: $RET!" else if [ -d /var/lock/subsys ] ; then touch /var/lock/subsys/posadis fi echo "done" RET=0 fi #end start ;; stop) #stop if test ! -f $PIDFILE ; then echo "Posadis not running" RET=0 else echo -n "Stopping Posadis... " kill `cat $PIDFILE` if [ $? != 0 ] ; then echo "failed!" rm -f $PIDFILE if [ -f /var/lock/subsys/posadis ] ; then rm /var/lock/subsys/posadis fi RET=1 else rm -f $PIDFILE if [ -f /var/lock/subsys/posadis ] ; then rm /var/lock/subsys/posadis fi echo "done" RET=0 fi fi #end stop RET=$? ;; status) #status if test ! -f $PIDFILE ; then echo "Posadis not running" RET=3 else ps ax | grep `cat $PIDFILE` | grep $POS6 RET=0 fi #end status ;; togglequerylog|tql) if test ! -f $PIDFILE ; then echo "Posadis not running" RET=0 else echo -n "Sending USR1 signal to toggle query logging" kill -USR1 `cat $PIDFILE` RET=$? fi ;; restart|update|reload) #stop if test ! -f $PIDFILE ; then echo "Posadis not running" RET=0 else echo -n "Stopping Posadis... " kill `cat $PIDFILE` if [ $? != 0 ] ; then echo "failed!" rm -f $PIDFILE if [ -f /var/lock/subsys/posadis ] ; then rm /var/lock/subsys/posadis fi RET=1 else rm -f $PIDFILE if [ -f /var/lock/subsys/posadis ] ; then rm /var/lock/subsys/posadis fi echo "done" RET=0 fi fi #end stop sleep 1 #start echo -n "Starting Posadis... " $POS6BIN -p $PIDFILE -f > /dev/null 2>&1 RET=$? if [ $RET != 0 ] ; then echo "failed: $RET!" else if [ -d /var/lock/subsys ] ; then touch /var/lock/subsys/posadis fi echo "done" RET=0 fi #end start ;; *) echo "Usage: $POS6 {start|stop|restart|update|reload|status|togglequerylog|tql}" exit 1 ;; esac exit $RET