首页 >
系统 >
linux
Jenkins自动发布 Build step 'Execute shell script on remote host using ssh' marked build as fai
时间:2022-08-30 16:06:54 点击: 来源: 作者:
Jenkins 自动发布突然出现:“Build step 'Execute shell script on remote host using ssh' marked build as failure”的错误。
具体错误信息大致如下: ...
Jenkins 自动发布突然出现:
“Build step 'Execute shell script on remote host using ssh' marked build as failure”
的错误。
具体错误信息大致如下:

有时候可以拉取成功 有时候不可以,处于不稳定的状态:

其他现象:ssh方式远程服务器,还会出现连接不上的情况,需要多次连接。
原因排查
由于错误信息中有ssh关闭连接的相关信息,我们首先查看当前ssh的连接数,这里以默认的22端口为例。
netstat -nat|grep -i "22"|wc -l

可以看到,当前连接数为19个。
vi /etc/ssh/sshd_config #编辑ssh配置文件,以下为MaxStartups的参数。
#MaxStartups 10:30:100
或
#MaxStartups 10
说明:根据系统版本,ssh软件的版本不同,格式略有不同。

上面默认配置的意思为,当连接数超过10个以后,后面再有新的连接,会有30%的连接会被关闭,超过100个直接关闭。
解决文案
刚才查看的已连接数为19个,是远远大于默认的连接数的。
所以,我们需要增大该数值,改为以下(去掉注释或新添一行,并根据自己实际情况改动):
MaxStartups 50:30:200
或(请根据自己系统中的格式选择合适自己的格式,错误选择可能会导致ssh重启失败)
MaxStartups 100
service sshd restart
重启服务,即可解决。
”您可通过以下微信二维码,赞赏作者“
