Created
March 15, 2019 10:11
-
-
Save tpopela/0f0e6af3e0b5dcc12f2a1376e7d78afd to your computer and use it in GitHub Desktop.
Restart iceccd service if ethernet connection changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Restarts iceccd service if ethernet connection changes | |
# | |
# Put it under /etc/NetworkManager/dispatcher.d/ | |
IF=$1 | |
STATUS=$2 | |
ETHERNET_IFACES=`nmcli device status | grep ethernet | awk '{ print $1 }'` | |
for ETHERNET_IF in $ETHERNET_IFACES; do | |
if [ "$ETHERNET_IF" == "$IF" ]; then | |
case "$2" in | |
up) | |
logger -s "Restarting iceccd.service" | |
systemctl restart iceccd.service | |
exit 0 | |
;; | |
down) | |
logger -s "Restarting iceccd.service" | |
systemctl restart iceccd.service | |
exit 0 | |
;; | |
*) | |
;; | |
esac | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment