mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
clientSTAT shows disabled clients at end
This commit is contained in:
parent
a3b7af869c
commit
8bff0b6cb6
1 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
# PiVPN: client status script
|
# PiVPN: client status script
|
||||||
|
|
||||||
CLIENTS_FILE="/etc/wireguard/configs/clients.txt"
|
CLIENTS_FILE="/etc/wireguard/configs/clients.txt"
|
||||||
|
CONF_FILE="/etc/wireguard/wg0.conf"
|
||||||
|
|
||||||
if [ ! -s "$CLIENTS_FILE" ]; then
|
if [ ! -s "$CLIENTS_FILE" ]; then
|
||||||
echo "::: There are no clients to list"
|
echo "::: There are no clients to list"
|
||||||
|
@ -44,7 +45,6 @@ listClients(){
|
||||||
BYTES_SENT="$(awk '{ print $7 }' <<< "$LINE")"
|
BYTES_SENT="$(awk '{ print $7 }' <<< "$LINE")"
|
||||||
LAST_SEEN="$(awk '{ print $5 }' <<< "$LINE")"
|
LAST_SEEN="$(awk '{ print $5 }' <<< "$LINE")"
|
||||||
CLIENT_NAME="$(grep "$PUBLIC_KEY" "$CLIENTS_FILE" | awk '{ print $1 }')"
|
CLIENT_NAME="$(grep "$PUBLIC_KEY" "$CLIENTS_FILE" | awk '{ print $1 }')"
|
||||||
|
|
||||||
if [ "$HR" = 1 ]; then
|
if [ "$HR" = 1 ]; then
|
||||||
if [ "$LAST_SEEN" -ne 0 ]; 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')"
|
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"
|
printf "\n"
|
||||||
} | column -t -s $'\t'
|
} | 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
|
if [[ $# -eq 0 ]]; then
|
||||||
|
|
Loading…
Reference in a new issue