|
|
@@ -34,7 +34,7 @@ def call(Map args = [:]) {
|
|
|
fi
|
|
|
'
|
|
|
"""
|
|
|
- PrintMes("√ 1. 旧进程清理完成,端口 ${remotePort} 已释放", 'yellow')
|
|
|
+ PrintMes("√ 1. 旧进程清理完成,端口 ${remotePort} 已释放", 'green')
|
|
|
|
|
|
|
|
|
/* 2. 备份旧包 */
|
|
|
@@ -44,7 +44,7 @@ def call(Map args = [:]) {
|
|
|
test -f ${remoteJar} && mv ${remoteJar} ${remoteJar}-\$(date +%Y%m%d%H%M) || true
|
|
|
'
|
|
|
"""
|
|
|
- PrintMes("√ 2. 旧 JAR 包备份完成", 'yellow')
|
|
|
+ PrintMes("√ 2. 旧 JAR 包备份完成", 'green')
|
|
|
|
|
|
|
|
|
/* 3. 传包 + MD5 强校验 */
|
|
|
@@ -71,13 +71,13 @@ def call(Map args = [:]) {
|
|
|
PrintMes("× 3. MD5 校验失败:本地 ${localMd5} != 远程 ${remoteMd5}", 'red')
|
|
|
error("MD5 校验失败:本地 ${localMd5} != 远程 ${remoteMd5}")
|
|
|
}
|
|
|
- PrintMes("√ 3. JAR 包传输和 MD5 校验成功", 'yellow')
|
|
|
+ PrintMes("√ 3. JAR 包传输和 MD5 校验成功", 'green')
|
|
|
|
|
|
|
|
|
/* 4. 启动新进程 */
|
|
|
PrintMes("→ 4. 启动新进程 (profile=${profile})", 'yellow')
|
|
|
sh """ssh -o StrictHostKeyChecking=no ${remoteHost} "sh -c 'cd ${remotePath} && nohup java ${jvmArgs} -jar ${jarName} --spring.profiles.active=${profile} > server.log 2>&1 &'" """
|
|
|
- PrintMes("√ 4. 新进程启动命令已发送", 'yellow')
|
|
|
+ PrintMes("√ 4. 新进程启动命令已发送", 'green')
|
|
|
|
|
|
|
|
|
/* 5. 按 profile 精确校验:有且仅有 1 个进程 */
|
|
|
@@ -92,12 +92,12 @@ def call(Map args = [:]) {
|
|
|
PrintMes("× 5. 启动校验失败:期望 1 个 ${profile} 进程,实际 ${procCount} 个", 'red')
|
|
|
error("启动校验失败:期望 1 个 ${profile} 进程,实际 ${procCount} 个")
|
|
|
}
|
|
|
- PrintMes("√ 5. 进程数量校验成功", 'yellow')
|
|
|
+ PrintMes("√ 5. 进程数量校验成功", 'green')
|
|
|
|
|
|
|
|
|
/* 6. 端口已被新进程占用 (加入等待重试机制) */
|
|
|
def maxRetries = 12 // 最多重试 12 次
|
|
|
- def waitTimeSec = 5 // 每次间隔 5 秒
|
|
|
+ def waitTimeSec = 5 // 每次间隔 10 秒
|
|
|
String newPid = ""
|
|
|
|
|
|
PrintMes("→ 6. 校验端口 ${remotePort} 是否已被新进程监听 (最大等待 ${maxRetries * waitTimeSec} 秒)", 'yellow')
|
|
|
@@ -120,7 +120,7 @@ def call(Map args = [:]) {
|
|
|
PrintMes("× 6. 端口 ${remotePort} 在 ${maxRetries * waitTimeSec} 秒内未被新进程监听,启动可能失败", 'red')
|
|
|
error("端口 ${remotePort} 未被新进程监听,启动超时失败")
|
|
|
}
|
|
|
- PrintMes("√ 6. 端口监听校验成功", 'yellow')
|
|
|
+ PrintMes("√ 6. 端口监听校验成功", 'green')
|
|
|
|
|
|
|
|
|
// 最终成功提示
|