From: Patrick Jaques (pjaques@comcast.net)
Date: Thu Aug 05 2004 - 16:54:45 CDT
This is the dhcpd script from the HowTo manual and works fine for RedHat 9.0
and Fedora.
#!/bin/bash
# dhcpd - init file for ISC DHCPd
#
# description: Internet Software Consortium DHCP Server Daemon
# source function library
. /etc/init.d/functions
# source networking functions
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# Check that ISC DHCPD files exist
[ -f /usr/sbin/dhcpd ] || exit 0
[ -f /etc/dhcpd/dhcpd.conf ] || exit 0
[ -f /var/state/dhcp/dhcpd.leases ] || exit 0
OPTIONS="-cf /etc/dhcpd/dhcpd.conf -lf /var/state/dhcp/dhcpd.leases"
RETVAL=0
prog="dhcpd"
start() {
echo -n $"Starting $prog: "
daemon /usr/sbin/dhcpd $OPTIONS
RETVAL=$?
echo
touch /var/lock/subsys/dhcpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc /usr/sbin/dhcpd
RETVAL=$?
echo
rm -f /var/lock/subsys/dhcpd
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc /usr/sbin/dhcpd -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/dhcpd ] && restart
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
status dhcpd
RETVAL=$?
;;
*)
echo $"Usage: $0
{start|stop|status|restart|condrestart|reload}"
RETVAL=1
esac
exit $RETVAL
-- Patrick
-----Original Message-----
From: owner-netreg@southwestern.edu [mailto:owner-netreg@southwestern.edu]
On Behalf Of Robert Lowe
Sent: Thursday, August 05, 2004 4:05 PM
To: netreg@southwestern.edu
Subject: Re: NetReg: Problem starting DHCPd
Ronald I. Nutter wrote:
> Here is the dhcpd script that I am using -
>
> Last login: Thu Aug 5 14:51:05 2004
> [root@resnet root]# service dhcpd start
> /etc/init.d/dhcpd: line 76: syntax error near unexpected token `$0'
> /etc/init.d/dhcpd: line 76: ` echo $"Usage: $0
> {start|stop|status|restart|condrestart|reload}"'
> [root@resnet root]# cd /etc/rc.d/init.d
> [root@resnet init.d]# cat dhcpd | more
> #!/bin/bash
> #dhcpd - init file for ISC DHCPd
> #
> #description: Internet Software Consortium DHCP Server Daemon
>
> #source function library
> . /etc/init.d/functions
>
> #source networking functions
> . /etc/sysconfig/network
>
> #Check that networking is up
> [ ${NETWORKING} = "no" ] && exit 0
>
> #Check that ISC DHCPD files exist
> [ -f /usr/sbin/dhcpd ] || exit 0
> [ -f /etc/dhcpd/dhcpd.conf ] || exit 0
> [ -f /var/state/dhcp/dhcpd.leases ] || exit 0
>
> OPTIONS="-cf /etc/dhcpd/dhcpd.conf -lf /var/state/dhcp/dhcpd.leases"
> RETVAL=0 prog="dhcpd"
>
> start() {
> echo -n $"Starting $prog: "
> daemon /usr/sbin/dhcpd $OPTIONS
> RETVAL=$?
> echo
> touch /var/lock/subsys/dhcpd
> return $RETVAL
> }
> stop() {
> echo -n $"Stopping $prog: "
> killproc /usr/sbin/dhcpd
> RETVAL=$?
> echo
> rm -v /var/lock/subsys/dhcpd
> return $RETVAL
> }
> reload(){
> echo -n $"Reloading $prog: "
> killproc /usr/sbin/dhcpd -HUP
> RETVAL=$?
> echo
> return $RETVAL
> }
> restart(){
> stop
> start
> }
> condrestart(){
> [-e /var/lock/subsys/dhcpd ] && restart
> return 0
> }
> case "$1"" in
> start)
> start
> ;;
> stop)
> stop
> ;;
> restart)
> restart
> ;;
> reload)
> reload
> ;;
> condrestart)
> condrestart
> ;;
> status)
> status dhcpd
> RETVAL=$?
> ;;
> *)
> echo $"Usage: $0
^
remove
-Robert
> {start|stop|status|restart|condrestart|reload}"
> RETVAL=1
> esac
> exit $RETVAL
> [root@resnet init.d]#
**********************************************************************
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
**********************************************************************
**********************************************************************
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
**********************************************************************
This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:47 CDT