From ebf1819a1cb514f2d4294b99d3efa3eebe6ea49c Mon Sep 17 00:00:00 2001 From: Ansi Zhang Date: Sat, 7 Mar 2020 07:58:36 +0800 Subject: [PATCH] Update wireguard.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原先 client_files=($(find /etc/wireguard -name "*_client" | sort)) 在软连接目录下无法查询,需多个反斜杠 --- wireguard.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wireguard.sh b/wireguard.sh index 63c6bca..a3c5b8b 100644 --- a/wireguard.sh +++ b/wireguard.sh @@ -511,7 +511,7 @@ add_client() { fi done # Get information from default interface file - client_files=($(find /etc/wireguard -name "*_client" | sort)) + client_files=($(find /etc/wireguard/ -name "*_client" | sort)) client_ipv4=() client_ipv6=() for ((i=0; i<${#client_files[@]}; i++)); do @@ -632,7 +632,7 @@ list_clients() { local line="+-------------------------------------------------------------------------+\n" local string=%-35s printf "${line}|${string} |${string} |\n${line}" " Client Interface" " Client's IP" - client_files=($(find /etc/wireguard -name "*_client" | sort)) + client_files=($(find /etc/wireguard/ -name "*_client" | sort)) ips=($(grep -w "AllowedIPs" ${default_server_if} | awk '{print $3}')) [ ${#client_files[@]} -ne ${#ips[@]} ] && echo "One or more client interface file is missing in /etc/wireguard" && exit 1 for ((i=0; i<${#ips[@]}; i++)); do