Last active
January 28, 2024 13:12
-
-
Save missing233/3dafb6ee549ed2271c20bd700b88a9cd to your computer and use it in GitHub Desktop.
DHCPv6 script for NTT Flet's Hikari Cross
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/sh | |
# Place in /etc/hotplug.d/iface/ | |
[ "$INTERFACE" = "wan6" ] || exit 0 | |
CRON_CMD='0 * * * * kill -SIGUSR1 $(pgrep odhcp6c)' | |
if [ "$ACTION" = "ifup" ]; then | |
grep -Fq "$CRON_CMD" /etc/crontabs/root || { | |
echo "$CRON_CMD" >> /etc/crontabs/root | |
/etc/init.d/cron restart | |
} | |
elif [ "$ACTION" = "ifdown" ]; then | |
sed -i "/$(printf '%b' "$CRON_CMD" | sed 's:[\\/.*^$]:\\&:g')/d" /etc/crontabs/root | |
/etc/init.d/cron restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment