Last active
November 5, 2022 06:33
-
-
Save anoduck/9dd45c15479fc1159b612015993e0a21 to your computer and use it in GitHub Desktop.
ifplugd ifupdown action script (see https://linux.die.net/man/8/ifplugd)
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 | |
set -e | |
set -o errexit | |
set -o nounset | |
if [ -z "$1" ] || [ -z "$2" ] ; then | |
echo "Wrong arguments" > /dev/stderr | |
exit 1 | |
fi | |
case "$2" in | |
up) | |
/usr/bin/ip link set $1 up | |
[ "$2" = "up" ] && exec /usr/sbin/dhclient $1 | |
;; | |
down) | |
if [ "$2" = "down" ]; then | |
/usr/sbin/dhclient -x | |
/usr/bin/ip link set $1 down | |
fi | |
;; | |
esac | |
exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment