dhcpd script

Chow Chi Ho (FP&HO) chchow at cabletv.com.hk
Wed Apr 4 13:12:08 UTC 2007



I am using RHAS4. 
Thanks for your help

-----Original Message-----
From: dhcp-users-bounce at isc.org [mailto:dhcp-users-bounce at isc.org]On Behalf Of Glenn Satchell
Sent: Wednesday, April 04, 2007 9:00 PM
To: dhcp-users at isc.org
Subject: Re: dhcpd script



>X-Original-To: dhcp-users at webster.isc.org
>Content-class: urn:content-classes:message
>Subject: dhcpd script
>Date: Wed, 4 Apr 2007 10:15:40 +0800
>Thread-Topic: LeaseQuery bug (?) in 3.1.0a3
>Thread-Index: Acd2AeiN+aY5U+7TRB6TgqhC7u5Q4wAXPnTg
>From: "Chow Chi Ho \(FP&HO\)" <chchow at cabletv.com.hk>
>To: <dhcp-users at isc.org>
>X-archive-position: 3350
>X-ecartis-version: Ecartis v1.0.0
>X-original-sender: chchow at cabletv.com.hk
>List-software: Ecartis version 1.0.0
>X-List-ID: <dhcp-users.isc.org>
>X-list: dhcp-users
>
>Hi all,
>
>Where can I find the /etc/init.d/dhcpd script ?
>
>
>
What operating system are you using. For most Linux distributions this
script is included with the operating system. FOr other operating
systems you can roll your own.

Generally it is very simple. Here is an example I have used for many
years with Solaris. I'm sure it could be easily adapted to others.

#       dhcpd control

PIDDIR=/var/run

if [ -f $PIDDIR/dhcpd.pid ]; then
        pid=`cat $PIDDIR/dhcpd.pid`
fi

case $1 in
start)
        if [ -x /usr/local/sbin/dhcpd ]; then
                if [ -n "$pid" ]; then
                        if ps -p $pid | grep dhcpd >/dev/null; then
                                echo DHCPD already running
                        else
                                rm -f $PIDDIR/dhcpd.pid
                                /usr/local/sbin/dhcpd
                                sleep 1
                        fi
                else
                        rm -f $PIDDIR/dhcpd.pid
                        /usr/local/sbin/dhcpd
                        sleep 1
                fi
        fi
        ;;
stop)
        if [ "${pid}" != "" ]; then
                /usr/bin/kill ${pid}
        fi
        rm -f $PIDDIR/dhcpd.pid
        ;;
*)
        echo "usage: /etc/init.d/dhcpd {start|stop}"
        ;;
esac

Note to anyone using Solaris 10. I have SMF scripts and xml to place
dhcpd under Service Management Facility control. SMF is init scripts on
steroids :)

regards,
-glenn



More information about the dhcp-users mailing list