From a3a01fc80fac37a11d3229826e9be830bcac9dec Mon Sep 17 00:00:00 2001 From: seaHi Date: Fri, 9 Oct 2026 15:13:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20chrony=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=BA=90=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91=E4=BB=A5?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=AF=86=E5=88=AB=E5=90=8C=E6=AD=A5=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3-5-compute.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/3-5-compute.sh b/3-5-compute.sh index f0787f8..6f7668b 100755 --- a/3-5-compute.sh +++ b/3-5-compute.sh @@ -252,8 +252,11 @@ chrony_synced() { local sources sources=$(timeout 10 chronyc -n sources) || return 1 printf '%s\n' "$sources" | awk -v ip="$CONTROLLER_IP" ' - $1=="^*" && $2==ip {found=1} - $1 ~ /^[\^=]/ && $2!=ip {bad=1} + # 时间源标记只有两个字符(如 ^*、^?、=+);排除表头的等号分隔线。 + length($1)==2 && (substr($1,1,1)=="^" || substr($1,1,1)=="=") { + if($1=="^*" && $2==ip) found=1 + if($2!=ip) bad=1 + } END{exit !(found && !bad)}' } check 2 'chrony 已安装' 'chrony 未安装(第1步:安装软件)' rpm -q chrony