mirror of
https://github.com/pivpn/pivpn.git
synced 2025-04-26 17:20:12 +00:00
Added missing script folder
This commit is contained in:
parent
24a1a00d37
commit
5e16322f9e
15 changed files with 1681 additions and 0 deletions
23
scripts/wireguard/listCONF.sh
Executable file
23
scripts/wireguard/listCONF.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /etc/wireguard/configs
|
||||
if [ ! -s clients.txt ]; then
|
||||
echo "::: There are no clients to list"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Present the user with a summary of the clients, fetching info from dates.
|
||||
FORMATTED+=": \e[4mClient\e[0m&\e[4mCreation date\e[0m :\n"
|
||||
|
||||
while read -r LINE; do
|
||||
CLIENT_NAME="$(awk '{print $1}' <<< "$LINE")"
|
||||
|
||||
CREATION_DATE="$(awk '{print $2}' <<< "$LINE")"
|
||||
|
||||
# Dates are converted from UNIX time to human readable.
|
||||
CD_FORMAT="$(date -d @"$CREATION_DATE" +'%d %b %Y, %H:%M, %Z')"
|
||||
|
||||
FORMATTED+="• $CLIENT_NAME&$CD_FORMAT\n"
|
||||
done < clients.txt
|
||||
|
||||
echo -e "$FORMATTED" | column -t -s '&'
|
Loading…
Add table
Add a link
Reference in a new issue