Add command to list server and all clients by creation date

This commit is contained in:
Paul-Christian Volkmer 2022-12-01 20:43:27 +01:00
parent 22dc642ffe
commit cac4c23574
2 changed files with 11 additions and 0 deletions

View File

@ -36,6 +36,11 @@ case "$1" in
/scripts/show-client.sh $2 /scripts/show-client.sh $2
exit 0 exit 0
;; ;;
'ls-configs')
cd /etc/wireguard
/scripts/ls-configs.sh
exit 0
;;
*) *)
echo "Starting wg-quick on $DEVICE" echo "Starting wg-quick on $DEVICE"
touch "${WG_LOG_FILE}" touch "${WG_LOG_FILE}"

6
scripts/ls-configs.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
echo "Configurations - sorted by creation date"
echo
echo "Server"
cat "$DEVICE.conf" | grep -e "# Client" -e "# <-" | grep -a "#" | sed "s/# //" | sed "s/<- //" | sed "s/\(.*\)\([0-9]\{4\}\)/Created: \1\2\n/"