/[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 139289 - (show annotations) (download)
Tue Sep 6 08:28:27 2011 UTC (8 years, 10 months ago) by guillomovitch
File size: 2810 byte(s)
SILENT: cosmetics fixes in init scripts
1 #!/bin/sh
2 #
3 ### BEGIN INIT INFO
4 # Provides: dhcpd
5 # Default-Start:
6 # Default-Stop: 0 6
7 # Should-Start: ldap
8 # Required-Start: $network
9 # Should-Stop: ldap
10 # Required-Stop:
11 # Short-Description: Start and stop the DHCP server
12 # Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
13 # server.
14 ### END INIT INFO
15 #
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 # config: /etc/dhcpd.conf
23 # config: /var/lib/dhcpd/dhcpd.leases
24 # pidfile: /var/run/dhcpd.pid
25
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 # Values specified in this file override the defaults above.
41 [ -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 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 }
59
60 stop() {
61 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 }
75
76 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 case "$1" in
88 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 esac
117
118 exit $RETVAL

  ViewVC Help
Powered by ViewVC 1.1.28