From 43ea49f03d37426e9f1b3751ee1e902a3055eed4 Mon Sep 17 00:00:00 2001 From: panjunjie <46790855@qq.com> Date: Fri, 12 Dec 2025 20:54:24 +0800 Subject: [PATCH] fix sh bug fix sh bug --- Jenkinsfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7049c18..f51fe67 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,9 +29,16 @@ pipeline { cp -r ${DIST_PATH}/* ${DEPLOY_DIR}/ echo "主节点部署完成:${DIST_PATH} → ${DEPLOY_DIR}" - echo "重启 Nginx 服务..." - systemctl restart nginx - echo "已重启服务" + # 2. Nginx 操作(优先热重载,无停机) + echo "检查 Nginx 配置语法..." + /usr/sbin/nginx -t # 先校验配置,避免重载失败 + + echo "热重载 Nginx 配置..." + # Debian systemd 下的正确写法(绝对路径+sudo,需提前配置免密) + sudo /usr/bin/systemctl reload nginx # 重载比 restart 更友好 + # 若必须重启:sudo /usr/bin/systemctl restart nginx + + echo "Nginx 操作完成" """ } }