/[packages]/cauldron/dhcp/current/SOURCES/dhcpd.init
ViewVC logotype

Contents of /cauldron/dhcp/current/SOURCES/dhcpd.init

Parent Directory Parent Directory | Revision Log Revision Log


Revision 136414 - (show annotations) (download)
Tue Aug 30 07:02:43 2011 UTC (12 years, 7 months ago) by tv
File size: 2807 byte(s)
add missing LSB keywords
1 #!/bin/bash
2 #
3 # dhcpd This shell script takes care of starting and stopping
4 # dhcpd.
5 #
6 # chkconfig: 345 65 35
7 # description: dhcpd provides the Dynamic Host Configuration Protocol service.
8 #
9 # processname: dhcpd
10 # config: /etc/dhcpd.conf
11 # pidfile: /var/run/dhcpd/dhcpd.pid
12 #
13 ### BEGIN INIT INFO
14 # Provides: dhcpd
15 # Required-Start: $network
16 # Should-Start: ldap
17 # Required-Stop: $network
18 # Default-Stop: 0 6
19 # Should-Stop: ldap
20 # Short-Description: The dhcpd daemon
21 # Description: dhcpd provides the Dynamic Host Configuration Protocol service.
22 ### END INIT INFO
23
24 # Source function library.
25 . /etc/rc.d/init.d/functions
26
27 # Source networking configuration.
28 . /etc/sysconfig/network
29
30 # Check that networking is up.
31 [ ${NETWORKING} = "no" ] && exit 0
32
33 [ -x /usr/sbin/dhcpd ] || exit 0
34
35 # The following variables should be set in the file
36 # /etc/sysconfig/dhcpd.
37
38 # Which configuration file to use.
39 CONFIGFILE="/etc/dhcpd.conf"
40 # Where to store the lease state information.
41 LEASEFILE="/var/lib/dhcp/dhcpd.leases"
42 # Define INTERFACES to limit which network interfaces dhcpd listens on.
43 # The default null value causes dhcpd to listen on all interfaces.
44 INTERFACES=""
45 # Define OPTIONS with any other options to pass to the dhcpd server.
46 OPTIONS="-q"
47
48 # Source dhcpd configuration. Values specified in this file override
49 # the defaults above.
50 [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
51
52 # If null values were specified, use defaults so we don't get a syntax
53 # error below.
54 [ "${CONFIGFILE}" = "" ] && CONFIGFILE="/etc/dhcpd.conf"
55 [ "${LEASEFILE}" = "" ] && LEASEFILE="/var/lib/dhcp/dhcpd.leases"
56
57 [ -f $CONFIGFILE ] || exit 0
58 [ -f $LEASEFILE ] || exit 0
59
60 RETVAL=0
61
62 start() {
63 # Start daemons.
64 echo -n "Starting dhcpd: "
65 if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
66 OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"
67 fi
68 daemon /usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
69 RETVAL=$?
70 echo
71 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
72 return $RETVAL
73 }
74
75 stop() {
76 # Stop daemons.
77 echo -n "Shutting down dhcpd: "
78 if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd.pid ]; then
79 kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd.pid`
80 RETVAL=$?
81 [ "$RETVAL" = 0 ] && success "stop" || failure "stop"
82 else
83 success "already stopped"
84 RETVAL=0
85 fi
86 [ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd.pid
87 [ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd
88 echo
89 return $RETVAL
90 }
91
92 # See how we were called.
93 case "$1" in
94 start)
95 start
96 ;;
97 stop)
98 stop
99 ;;
100 restart|reload)
101 stop
102 start
103 RETVAL=$?
104 ;;
105 condrestart)
106 if [ -f /var/lock/subsys/dhcpd ]; then
107 stop
108 start
109 RETVAL=$?
110 fi
111 ;;
112 status)
113 status dhcpd
114 RETVAL=$?
115 ;;
116 *)
117 echo "Usage: dhcpd {start|stop|restart|condrestart|status}"
118 exit 1
119 esac
120
121 exit $RETVAL

  ViewVC Help
Powered by ViewVC 1.1.30