From cac4c23574a47636392727d6c25e66461e479f2b Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Thu, 1 Dec 2022 20:43:27 +0100 Subject: [PATCH] Add command to list server and all clients by creation date --- scripts/entrypoint.sh | 5 +++++ scripts/ls-configs.sh | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100755 scripts/ls-configs.sh diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 2211f6b..80813c6 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -36,6 +36,11 @@ case "$1" in /scripts/show-client.sh $2 exit 0 ;; + 'ls-configs') + cd /etc/wireguard + /scripts/ls-configs.sh + exit 0 + ;; *) echo "Starting wg-quick on $DEVICE" touch "${WG_LOG_FILE}" diff --git a/scripts/ls-configs.sh b/scripts/ls-configs.sh new file mode 100755 index 0000000..bd7ac89 --- /dev/null +++ b/scripts/ls-configs.sh @@ -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/"