如何减少ssh连接超时值 [英] how to decrease ssh connection timeout value

查看:95
本文介绍了如何减少ssh连接超时值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有完整的远程主机IP地址的列表.我编写了一个脚本来逐一连接此列表中的所有主机.我的问题是,有时当IP地址关闭时,脚本会等待一段时间(可能是几分钟)以执行下一个主机.所以我想减少这个等待时间.例如10秒后,我希望ssh连接超时并且我的脚本尝试下一个IP地址.那么我该如何调整呢?

I have a list of full remote host ip addresses. I wrote a script to connect all the hosts in this list, one by one. My question is, sometimes when an IP address is down, script waits for a while (maybe a couple of minute) to go and execute next host. So I would like to decrease this waiting time. For example after 10 s, I want ssh connection is timeout and my script tries the next IP address. So how I can tweak this?

谢谢

推荐答案

如果调用ssh脚本,则可以使用类似的东西

if you call ssh script you can use something like that

ssh -o ConnectTimeout=10  <hostName>

其中10是秒数

这篇关于如何减少ssh连接超时值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆