From a4c3d9c57edf523e62c632343cd9d25786127e9e Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Sat, 18 May 2019 23:08:32 +0200 Subject: [PATCH] Added script to switch wireguard interfaces up/down --- wireguard/.scripts/vpn-switch.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 wireguard/.scripts/vpn-switch.sh diff --git a/wireguard/.scripts/vpn-switch.sh b/wireguard/.scripts/vpn-switch.sh new file mode 100755 index 0000000..5294185 --- /dev/null +++ b/wireguard/.scripts/vpn-switch.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +### +# Switch wireguard vpns up/down +### + +STATUS="$(nmcli device status | grep -c wg0)" + +case $STATUS in + 1) + sudo wg-quick down wg0 + sudo wg-quick down wg1 + ;; + *) + sudo wg-quick up wg0 + sudo wg-quick up wg1 + ;; + esac