summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2024-04-04 01:03:23 +0200
committerPatrick Spek <p.spek@tyil.nl>2024-04-04 01:03:23 +0200
commitca402ae8409ae9eb1a8b679d46339b60f2df238d (patch)
tree6c72c46ca1c071fbaa685a30f275bf5a5c904aee
parent74d29dc95c3a25649d7d4ce7064052df42a841b4 (diff)
Sort the vpn-wireguard connectivity check output
-rwxr-xr-xdata.d/vpn-wireguard/hooks/post-up5
1 files changed, 4 insertions, 1 deletions
diff --git a/data.d/vpn-wireguard/hooks/post-up b/data.d/vpn-wireguard/hooks/post-up
index b200922..edbcd50 100755
--- a/data.d/vpn-wireguard/hooks/post-up
+++ b/data.d/vpn-wireguard/hooks/post-up
@@ -3,6 +3,7 @@
readonly COLOR_RESET="\033[0m"
readonly COLOR_OK="\033[32;1m"
readonly COLOR_NOK="\033[31;1m"
+readonly BUFFER="$(mktemp)"
main() {
printf "Verifying connectability...\n"
@@ -15,6 +16,8 @@ main() {
done < <(awk -F= '/vpn-wireguard.ipv(4|6)=/ { print $NF }' /etc/bashtard/hosts.d/*)
wait
+
+ sort -- "$BUFFER" >&2
}
check() {
@@ -38,7 +41,7 @@ log() {
color="$COLOR_OK"
fi
- printf "%b%3s%b: %s\n" "$color" "$state" "$COLOR_RESET" "$addr" >&2
+ printf "%b%3s%b: %s\n" "$color" "$state" "$COLOR_RESET" "$addr" >> "$BUFFER"
}
main "$@"