diff --git a/sub/bash/functions b/sub/bash/functions index 6fe01a4..5dfd6fd 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -151,3 +151,10 @@ py() { test -z "$@" && ipython -i -c "q = exit" || python3 $@ } +vpn() { + local STATUS SERVICE + SERVICE="wg-quick@wg0.service" + STATUS=$(systemctl status $SERVICE | grep Active | awk -F ": " '{printf $2}' | awk -F " " '{printf $1}') + test $STATUS = "inactive" && sudo systemctl start $SERVICE || sudo systemctl stop $SERVICE +} +