From 190a4d8ab132091fa3547e360a4b68af8b024741 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Tue, 19 Jul 2022 20:34:37 +0300 Subject: [PATCH] style: vpn func --- sub/bash/functions | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sub/bash/functions b/sub/bash/functions index 2d9aba7..01adb95 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -169,9 +169,11 @@ vpn() { test -e "$CONFIGFILE" || (echo "Config '$CONFIGFILE' not exists" >&2; return 1) && ( - SERVICE="wg-quick@$CONFIG.service" + SERVICE="wg-quick@$CONFIG.service" - systemctl --quiet is-active "$SERVICE" && sudo systemctl stop "$SERVICE" || sudo systemctl start "$SERVICE" + systemctl --quiet is-active "$SERVICE" && \ + (sudo systemctl stop "$SERVICE" && echo DOWN) || \ + (sudo systemctl start "$SERVICE" && ip -br a | grep wg0 | awk '{print $1":\t"$3}') ) }