Re: NetReg: Startup Scripts for SuSE 9.0

New Message Reply Date view Thread view Subject view Author view Attachment view

From: Robert Lowe (Robert.H.Lowe@lawrence.edu)
Date: Thu Aug 05 2004 - 15:15:35 CDT


Rick Whitley wrote:

Hi Rick!

> I have gone through the excellant Howto from Patrick Jaques. However his
> howto is for RedHat and I am running SuSE 9.0. When I try to start dhcpd
> I get an error for the daemon command and the /etc/init.d/functions does
> not exist. Has anyone on the list got this to work with SuSE and be
> willing to share how they got around these issues? Any help is greatly
> appreciated.

I'd recommend starting with the apachectl script that comes with apache
and modifying it for dhcpd. You'll end up with something like the
following.

-Robert

# the path to your PID file
PIDFILE=/var/run/dhcpd.pid
#
# the path to your dhcpd binary, including options if necessary
DHCPD='/usr/sbin/dhcpd -cf /etc/dhcpd/dhcpd.conf -lf /var/state/dhcp/dhcpd.leases -q'
#
# -------------------- --------------------
# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||

ERROR=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
     ARGS="help"
fi

for ARG in $@ $ARGS
do
     # check for pidfile
     if [ -f $PIDFILE ] ; then
        PID=`cat $PIDFILE`
        if [ ! "x$PID" = "x" ] && kill -0 $PID; then
            STATUS="dhcpd (pid $PID) running"
            RUNNING=1
        else
            STATUS="dhcpd (pid $PID?) not running"
            RUNNING=0
        fi
     else
        STATUS="dhcpd (no pid file) not running"
        RUNNING=0
     fi

     case $ARG in
     start)
        if [ $RUNNING -eq 1 ]; then
            echo "$0 $ARG: dhcpd (pid $PID) already running"
            continue
        fi
        if $DHCPD ; then
             echo "$0 $ARG: dhcpd started"
        else
            echo "$0 $ARG: dhcpd could not be started"
            ERROR=3
        fi
        ;;
     stop)
        if [ $RUNNING -eq 0 ]; then
            echo "$0 $ARG: $STATUS"
            continue
        fi
        if kill $PID ; then
            echo "$0 $ARG: dhcpd stopped"
             rm $PIDFILE
        else
            echo "$0 $ARG: dhcpd could not be stopped"
            ERROR=4
        fi
        ;;
     *)
        echo "usage: $0 (start|stop)"
        cat <<EOF

start - start dhcpd
stop - stop dhcpd
EOF
        ERROR=2
     ;;

     esac

done

exit $ERROR

**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************


New Message Reply Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:47 CDT