philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/12-dhcpd

c8bb8f
#!/bin/bash
c8bb8f
c8bb8f
INTERFACE=$1 # The interface which is brought up or down
c8bb8f
STATUS=$2 # The new state of the interface
c8bb8f
c8bb8f
# whenever interface is brought up by NM (rhbz #565921)
c8bb8f
if [ "$STATUS" = "up" ]; then
c8bb8f
    # restart the services
8377c7
    # In case this dispatcher script is called several times in a short period of time, it might happen that
8377c7
    # systemd refuses to further restart the units. Therefore we use reset-failed command to prevent it.
8377c7
    systemctl -q is-enabled dhcpd.service && systemctl restart dhcpd.service && systemctl reset-failed dhcpd.service
8377c7
    systemctl -q is-enabled dhcpd6.service && systemctl restart dhcpd6.service && systemctl reset-failed dhcpd6.service
c8bb8f
fi
c8bb8f
c8bb8f
exit 0