9ba8b65
#!/bin/bash
9ba8b65
e812a0f
INTERFACE=$1 # The interface which is brought up or down
e812a0f
STATUS=$2 # The new state of the interface
9ba8b65
e812a0f
# whenever interface is brought up by NM (rhbz #565921)
e812a0f
if [ "$STATUS" = "up" ]; then
001230e
    # wait a few seconds to allow interface startup to complete
001230e
    # (important at boot time without this the service still fails
12990ac
    # time-out for dispatcher script is 3s (rhbz#1003695#8)
12990ac
    sleep 2
e812a0f
    # restart the services
4b570e2
    # In case this dispatcher script is called several times in a short period of time, it might happen that
4b570e2
    # systemd refuses to further restart the units. Therefore we use reset-failed command to prevent it.
4b570e2
    systemctl -q is-enabled dhcpd.service && systemctl restart dhcpd.service && systemctl reset-failed dhcpd.service
4b570e2
    systemctl -q is-enabled dhcpd6.service && systemctl restart dhcpd6.service && systemctl reset-failed dhcpd6.service
9ba8b65
fi
30b7632
30b7632
exit 0