当前位置:网站首页>Jenkins remote build project timeout problem

Jenkins remote build project timeout problem

2022-07-07 07:41:00 Cooked snail

Catalog

One 、 Problem description

Two 、 The analysis reason


One 、 Problem description

In the use of Publish Over SSH The following errors are always reported when carrying out remote deployment projects :ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,001 ms]

Two 、 The analysis reason

1、 Log analysis shows timeout , So modify the time , take 120000 It is amended as follows 300000, And then change it to 600000, They didn't solve the problem , So the elimination is not this problem

 

2、 Search online , be supposed to jenkins Kill it at startup build Process outside , You need to add this sentence to the script file BUILD_ID=dontKillMe, Plus, it's still not good .daemon The guardian thread . Not yet. .

3、 Some people say that there is insufficient space , Then execute the following command Cleared the cache , Not yet.

sync

echo 3 > /proc/sys/vm/drop_caches

4、 Later, start the script manually on the server , Found the problem , The last line , Log output line

Original script

 #!/bin/bash
source /etc/profile
project=test-wechat-1.0-SNAPSHOT.jar
dir=/opt/deploy/wechat
echo "prepare to deploy test-wechat-1.0-SNAPSHOT"
pid=`ps -ef |grep test-wechat-1.0-SNAPSHOT |grep -v grep| grep 'java' |awk '{print $2}'`
if [[ $pid ]]; then
    echo "test-wechat-1.0-SNAPSHOT is running and pid is $pid"
    kill -9 $pid
    if [[ $? -eq 0 ]];then
       echo "sucess to stop test-wechat-1.0-SNAPSHOT"
    else   
       echo "fail to stop test-wechat-1.0-SNAPSHOT"
    fi
fi
echo "start to deploy test-wechat-1.0-SNAPSHOT"
cd /opt/deploy/wechat/
nohup java -jar /opt/deploy/wechat/test-wechat-1.0-SNAPSHOT.jar --server.port=9003 >/dev/null 2>&1 &

I found that I was stuck on the page after startup , Although it is started in the background, there is no effect of background startup

Modify the script as follows , Problem solving .

 #!/bin/bash
source /etc/profile
project=test-wechat-1.0-SNAPSHOT.jar
dir=/opt/deploy/wechat
echo "prepare to deploy test-wechat-1.0-SNAPSHOT"
pid=`ps -ef |grep test-wechat-1.0-SNAPSHOT |grep -v grep| grep 'java' |awk '{print $2}'`
if [[ $pid ]]; then
    echo "test-wechat-1.0-SNAPSHOT is running and pid is $pid"
    kill -9 $pid
    if [[ $? -eq 0 ]];then
       echo "sucess to stop test-wechat-1.0-SNAPSHOT"
    else   
       echo "fail to stop test-wechat-1.0-SNAPSHOT"
    fi
fi
echo "start to deploy test-wechat-1.0-SNAPSHOT"
cd /opt/deploy/wechat/
nohup java -jar /opt/deploy/wechat/test-wechat-1.0-SNAPSHOT.jar --server.port=9003 > nohup.out 2>&1 &

  stay jenkins To configure , Be sure to add nohup , Otherwise, the project fails to start

Then I studied the instructions of log output , source      https://blog.csdn.net/sunrier/article/details/7695839

  However, I still don't understand why there is no backstage way to start , I hope the boss can discuss it together

原网站

版权声明
本文为[Cooked snail]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070349151625.html