From 22cbe5bb4a28375d1e762bc9acaa14485262db8d Mon Sep 17 00:00:00 2001 From: sans Date: Sun, 19 Jul 2026 02:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/templates_cert/setup-cert.sh.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/templates_cert/setup-cert.sh.j2 b/backend/templates_cert/setup-cert.sh.j2 index ba241a3..ff784a9 100644 --- a/backend/templates_cert/setup-cert.sh.j2 +++ b/backend/templates_cert/setup-cert.sh.j2 @@ -33,7 +33,10 @@ fi # 3. 写入定时任务 echo "[3/4] 配置定时任务(每小时执行一次)..." CRON_LINE="0 * * * * ${DEPLOY_SCRIPT} >> ${LOG_FILE} 2>&1" -(crontab -l 2>/dev/null | grep -v "${DEPLOY_SCRIPT}"; echo "${CRON_LINE}") | crontab - +EXISTING=$(crontab -l 2>/dev/null || true) +FILTERED=$(echo "${EXISTING}" | grep -v "${DEPLOY_SCRIPT}" || true) +echo "${FILTERED} +${CRON_LINE}" | crontab - echo " 已添加: ${CRON_LINE}" # 4. 验证