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

Annotation of /cauldron/dhcp/pristine/SOURCES/dhcpd.init

Parent Directory Parent Directory | Revision Log Revision Log


Revision 139289 - (hide annotations) (download)
Tue Sep 6 08:28:27 2011 UTC (12 years, 7 months ago) by guillomovitch
Original Path: cauldron/dhcp/current/SOURCES/dhcpd.init
File size: 2810 byte(s)
SILENT: cosmetics fixes in init scripts
1 guillomovitch 138691 #!/bin/sh
2 dmorgan 16733 #
3     ### BEGIN INIT INFO
4     # Provides: dhcpd
5 guillomovitch 138691 # Default-Start:
6     # Default-Stop: 0 6
7     # Should-Start: ldap
8 dmorgan 16733 # Required-Start: $network
9     # Should-Stop: ldap
10 guillomovitch 139289 # Required-Stop:
11 guillomovitch 138691 # Short-Description: Start and stop the DHCP server
12     # Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
13     # server.
14 dmorgan 16733 ### END INIT INFO
15 guillomovitch 138691 #
16     # The fields below are left around for legacy tools (will remove later).
17     #
18     # chkconfig: - 65 35
19     # description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \
20     # server
21     # processname: dhcpd
22 guillomovitch 139289 # config: /etc/dhcpd.conf
23 guillomovitch 138691 # config: /var/lib/dhcpd/dhcpd.leases
24     # pidfile: /var/run/dhcpd.pid
25 dmorgan 16733
26     . /etc/rc.d/init.d/functions
27    
28     [ -x /usr/sbin/dhcpd ] || exit 0
29    
30     # Which configuration file to use.
31     CONFIGFILE="/etc/dhcpd.conf"
32     # Where to store the lease state information.
33     LEASEFILE="/var/lib/dhcp/dhcpd.leases"
34     # Define INTERFACES to limit which network interfaces dhcpd listens on.
35     # The default null value causes dhcpd to listen on all interfaces.
36     INTERFACES=""
37     # Define OPTIONS with any other options to pass to the dhcpd server.
38     OPTIONS="-q"
39    
40 guillomovitch 139289 # Values specified in this file override the defaults above.
41 dmorgan 16733 [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
42    
43     [ -f $CONFIGFILE ] || exit 0
44     [ -f $LEASEFILE ] || exit 0
45    
46     RETVAL=0
47    
48     start() {
49 guillomovitch 139289 echo -n "Starting dhcpd: "
50     if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
51     OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"
52     fi
53     daemon /usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
54     RETVAL=$?
55     echo
56     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
57     return $RETVAL
58 dmorgan 16733 }
59    
60     stop() {
61 guillomovitch 139289 echo -n "Shutting down dhcpd: "
62     if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd.pid ]; then
63     kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd.pid`
64     RETVAL=$?
65     [ "$RETVAL" = 0 ] && success "stop" || failure "stop"
66     else
67     success "already stopped"
68     RETVAL=0
69     fi
70     [ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd.pid
71     [ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd
72     echo
73     return $RETVAL
74 dmorgan 16733 }
75    
76 guillomovitch 138691 configtest() {
77     /usr/sbin/dhcpd -q -t -cf $CONFIGFILE
78     RETVAL=$?
79     if [ $RETVAL -eq 1 ]; then
80     /usr/sbin/dhcpd -t -cf $CONFIGFILE
81     else
82     echo "Syntax: OK" >&2
83     fi
84     return $RETVAL
85     }
86    
87 dmorgan 16733 case "$1" in
88 guillomovitch 138691 start)
89     start
90     ;;
91     stop)
92     stop
93     ;;
94     restart|reload)
95     stop
96     start
97     RETVAL=$?
98     ;;
99     condrestart)
100     if [ -f /var/lock/subsys/dhcpd ]; then
101     stop
102     start
103     RETVAL=$?
104     fi
105     ;;
106     configtest)
107     configtest
108     ;;
109     status)
110     status dhcpd
111     RETVAL=$?
112     ;;
113     *)
114     echo "Usage: dhcpd {start|stop|restart|condrestart|status}"
115     exit 1
116 dmorgan 16733 esac
117    
118     exit $RETVAL

  ViewVC Help
Powered by ViewVC 1.1.30