Skip to content

Instantly share code, notes, and snippets.

@magicstone1412
Last active December 12, 2021 23:17
Show Gist options
  • Save magicstone1412/514d3b26f880ed8592d0ba087e572428 to your computer and use it in GitHub Desktop.
Save magicstone1412/514d3b26f880ed8592d0ba087e572428 to your computer and use it in GitHub Desktop.
Start all wireguard tunnels with wg-quick
#!/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