From 0e30607e341257b3bc18d2c8af7a34311e240110 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Fri, 15 Jul 2022 09:37:27 -0700 Subject: [PATCH] improve grep --- wg-cron.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wg-cron.sh b/wg-cron.sh index f2548de..028890b 100755 --- a/wg-cron.sh +++ b/wg-cron.sh @@ -30,7 +30,7 @@ if [ $clientCount -gt 0 ]; then do # remove peer from wireguard wg set wg0 peer ${clients[$i]} remove - config=$(grep ${clients[$i]} /etc/wireguard/peers/*.conf|cut -d : -f 1) + config=$(grep -l "PublicKey = ${clients[$i]}" /etc/wireguard/peers/*.conf) # add peer back to wireguard wg addconf wg0 $config done