philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/12-dhcpd

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