Last active
June 23, 2021 21:44
-
-
Save tubaman/6925ffd01197e3880e2298cf64fd9179 to your computer and use it in GitHub Desktop.
dhcpcd hook to restart shorewall whenever the IP address changes (put in /lib/dhcpcd/dhcpcd-hooks)
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
if [ "$interface" = eth1 ]; then | |
if [ "$if_up" = true ]; then | |
IP=`ip add show eth1|grep global |awk '{print $2}'` | |
PREVIOUS_IP=`cat /tmp/previous_ip` | |
if [ "$PREVIOUS_IP" != "$IP" ]; then | |
echo "$IP" > /tmp/previous_ip | |
systemctl restart shorewall.service | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment