12-dhcpd 596 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. export LC_ALL=C
  3. [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
  4. # restart dhcpd whenever $1 interface is brought up by NM (rhbz #565921)
  5. if [ "$2" = "up" ]; then
  6. # exit if the service is not configured to be started in the current runlevel
  7. /sbin/chkconfig dhcpd || exit 0
  8. # exit if dhcpd is not defined to listen on $1
  9. # i.e. if there are interfaces defined in DHCPDARGS and $1 is not among them
  10. if [ -n "${DHCPDARGS}" ] &&
  11. [[ "${DHCPDARGS}" == *eth* ]] &&
  12. [[ "${DHCPDARGS}" != *$1* ]]; then
  13. exit 0
  14. fi
  15. # restart service
  16. /sbin/service dhcpd restart || :
  17. fi