|
|
@@ -17,19 +17,20 @@ def call(Map args = [:]) {
|
|
|
PrintMes("开始发布 ${jarName} [profile=${profile}] 到 ${remoteHost}:${remotePort}", 'yellow')
|
|
|
|
|
|
try {
|
|
|
- /* 1. 按端口杀旧进程,并确认端口已释放 */
|
|
|
+/* 1. 按端口杀旧进程,并确认端口已释放 */
|
|
|
sh """
|
|
|
- ssh -o StrictHostKeyChecking=no ${remoteHost} \\
|
|
|
- 'OLD_PID=\\$(lsof -ti:${remotePort} || true)
|
|
|
- if [ -n "\\$OLD_PID" ]; then
|
|
|
- echo \"杀掉占用端口 ${remotePort} 的进程 \\$OLD_PID\"
|
|
|
- kill -9 \\$OLD_PID
|
|
|
+ ssh -o StrictHostKeyChecking=no ${remoteHost} '
|
|
|
+ OLD_PID=\$(lsof -ti:${remotePort} || true)
|
|
|
+ if [ -n "\$OLD_PID" ]; then
|
|
|
+ echo "杀掉占用端口 ${remotePort} 的进程 \$OLD_PID"
|
|
|
+ kill -9 \$OLD_PID
|
|
|
sleep 3
|
|
|
- fi
|
|
|
+ fi
|
|
|
if lsof -ti:${remotePort}; then
|
|
|
- echo \"端口 ${remotePort} 仍未释放,杀进程失败\"
|
|
|
- exit 1
|
|
|
- fi'
|
|
|
+ echo "端口 ${remotePort} 仍未释放,杀进程失败"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ '
|
|
|
"""
|
|
|
|
|
|
/* 2. 备份旧包 */
|