Last active
December 12, 2021 23:17
-
-
Save magicstone1412/514d3b26f880ed8592d0ba087e572428 to your computer and use it in GitHub Desktop.
Start all wireguard tunnels with wg-quick
This file contains hidden or 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
#!/sbin/openrc-run | |
# Nico Schottelius, 2020-07-02 | |
# Start all wireguard tunnels with wg-quick | |
# Copying: GPLv2 or later | |
do_wireguard() { | |
action=$1 | |
[ -d /etc/wireguard ] || exit 0 | |
cd /etc/wireguard | |
for conf in *.conf; do | |
name=${conf%%.conf} | |
[ ${name} = '*' ] && exit 0 | |
ebegin "wireguard ${action} ${name}" | |
wg-quick ${action} "$name" | |
done | |
} | |
start() { | |
do_wireguard up | |
} | |
stop() { | |
do_wireguard down | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment