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