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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 138691 by guillomovitch, Mon Sep 5 09:17:05 2011 UTC revision 139289 by guillomovitch, Tue Sep 6 08:28:27 2011 UTC
# Line 7  Line 7 
7  # Should-Start: ldap  # Should-Start: ldap
8  # Required-Start: $network  # Required-Start: $network
9  # Should-Stop: ldap  # Should-Stop: ldap
10    # Required-Stop:
11  # Short-Description: Start and stop the DHCP server  # Short-Description: Start and stop the DHCP server
12  # Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)  # Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
13  #              server.  #              server.
# Line 18  Line 19 
19  # description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \  # description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \
20  #              server  #              server
21  # processname: dhcpd  # processname: dhcpd
22  # config: /etc/dhcp/dhcpd.conf  # config: /etc/dhcpd.conf
23  # config: /var/lib/dhcpd/dhcpd.leases  # config: /var/lib/dhcpd/dhcpd.leases
24  # pidfile: /var/run/dhcpd.pid  # pidfile: /var/run/dhcpd.pid
25    
# Line 26  Line 27 
27    
28  [ -x /usr/sbin/dhcpd ] || exit 0  [ -x /usr/sbin/dhcpd ] || exit 0
29    
 # The following variables should be set in the file  
 # /etc/sysconfig/dhcpd.  
   
30  # Which configuration file to use.  # Which configuration file to use.
31  CONFIGFILE="/etc/dhcpd.conf"  CONFIGFILE="/etc/dhcpd.conf"
32  # Where to store the lease state information.  # Where to store the lease state information.
# Line 39  INTERFACES="" Line 37  INTERFACES=""
37  # Define OPTIONS with any other options to pass to the dhcpd server.  # Define OPTIONS with any other options to pass to the dhcpd server.
38  OPTIONS="-q"  OPTIONS="-q"
39    
40  # Source dhcpd configuration.  Values specified in this file override  # Values specified in this file override the defaults above.
 # the defaults above.  
41  [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd  [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
42    
 # If null values were specified, use defaults so we don't get a syntax  
 # error below.  
 [ "${CONFIGFILE}" = "" ] && CONFIGFILE="/etc/dhcpd.conf"  
 [ "${LEASEFILE}" = "" ] && LEASEFILE="/var/lib/dhcp/dhcpd.leases"  
   
43  [ -f $CONFIGFILE ] || exit 0  [ -f $CONFIGFILE ] || exit 0
44  [ -f $LEASEFILE ] || exit 0  [ -f $LEASEFILE ] || exit 0
45    
46  RETVAL=0  RETVAL=0
47    
48  start() {  start() {
49          # Start daemons.      echo -n "Starting dhcpd: "
50          echo -n "Starting dhcpd: "      if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
51          if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then          OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"
52                  OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"      fi
53          fi      daemon /usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
54          daemon /usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES      RETVAL=$?
55          RETVAL=$?      echo
56          echo      [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
57          [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd      return $RETVAL
         return $RETVAL  
58  }  }
59    
60  stop() {  stop() {
61          # Stop daemons.      echo -n "Shutting down dhcpd: "
62          echo -n "Shutting down dhcpd: "      if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd.pid ]; then
63          if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd.pid ]; then          kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd.pid`
64              kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd.pid`          RETVAL=$?
65              RETVAL=$?          [ "$RETVAL" = 0 ] && success "stop" || failure "stop"
66              [ "$RETVAL" = 0 ] && success "stop" || failure "stop"      else
67          else          success "already stopped"
68              success "already stopped"          RETVAL=0
69              RETVAL=0      fi
70          fi      [ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd.pid
71          [ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd.pid      [ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd
72          [ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd      echo
73          echo      return $RETVAL
         return $RETVAL  
74  }  }
75    
76  configtest() {  configtest() {
# Line 94  configtest() { Line 84  configtest() {
84      return $RETVAL      return $RETVAL
85  }  }
86    
 # See how we were called.  
87  case "$1" in  case "$1" in
88      start)      start)
89          start          start

Legend:
Removed from v.138691  
changed lines
  Added in v.139289

  ViewVC Help
Powered by ViewVC 1.1.30