From 0182b2066f4ebeec74eb121501e5b2cdd74e39eb Mon Sep 17 00:00:00 2001 From: darkclip Date: Thu, 4 Jan 2024 18:33:24 +0800 Subject: [PATCH] update --- wg-watch.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/wg-watch.sh b/wg-watch.sh index 86eff7a6..cc672fe4 100755 --- a/wg-watch.sh +++ b/wg-watch.sh @@ -231,13 +231,16 @@ main(){ exit; fi; endpoint=$(wg show $INTERFACE endpoints | awk '{print $2}'); - if [ $(uname -i) = 'pfSense' ]; then - if [ $(pfSsh.php playback wgpeer $CONFIG) != $endpoint ]; then - pfSsh.php playback wgpeer $CONFIG $(echo $endpoint|awk -F: '{print $1}') $(echo $endpoint|awk -F: '{print $2}') || true; - fi; - else - sed -i -r 's/Endpoint =.*/Endpoint = '$endpoint'/' $CONFIG; - fi; + case $(uname -i) in + pfSense) + if [ $(pfSsh.php playback wgpeer $CONFIG) != $endpoint ]; then + pfSsh.php playback wgpeer $CONFIG $(echo $endpoint|awk -F: '{print $1}') $(echo $endpoint|awk -F: '{print $2}') || true; + fi; + ;; + *) + sed -i -r 's/Endpoint =.*/Endpoint = '$endpoint'/' $CONFIG; + ;; + esac; };