From 8bff0b6cb669c3c510e5b98ad5eead05a47d5d0a Mon Sep 17 00:00:00 2001 From: Roger Haxby <63857845+shelleycat485@users.noreply.github.com> Date: Thu, 10 Dec 2020 12:34:49 +0000 Subject: [PATCH] clientSTAT shows disabled clients at end --- scripts/wireguard/clientSTAT.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/wireguard/clientSTAT.sh b/scripts/wireguard/clientSTAT.sh index 166085f..ae07a72 100755 --- a/scripts/wireguard/clientSTAT.sh +++ b/scripts/wireguard/clientSTAT.sh @@ -2,6 +2,7 @@ # PiVPN: client status script CLIENTS_FILE="/etc/wireguard/configs/clients.txt" +CONF_FILE="/etc/wireguard/wg0.conf" if [ ! -s "$CLIENTS_FILE" ]; then echo "::: There are no clients to list" @@ -44,7 +45,6 @@ listClients(){ BYTES_SENT="$(awk '{ print $7 }' <<< "$LINE")" LAST_SEEN="$(awk '{ print $5 }' <<< "$LINE")" CLIENT_NAME="$(grep "$PUBLIC_KEY" "$CLIENTS_FILE" | awk '{ print $1 }')" - if [ "$HR" = 1 ]; then if [ "$LAST_SEEN" -ne 0 ]; then printf "%s \t %s \t %s \t %s \t %s \t %s\n" "$CLIENT_NAME" "$REMOTE_IP" "${VIRTUAL_IP/\/32/}" "$(hr "$BYTES_RECEIVED")" "$(hr "$BYTES_SENT")" "$(date -d @"$LAST_SEEN" '+%b %d %Y - %T')" @@ -63,6 +63,11 @@ listClients(){ printf "\n" } | column -t -s $'\t' + + cd /etc/wireguard || return + echo "::: Disabled clients :::" + grep '\[disabled\] ### begin' wg0.conf | sed 's/#//g; s/begin//' + } if [[ $# -eq 0 ]]; then