问题
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?
Thanks
回答1:
if you call ssh script you can use something like that
ssh -o ConnectTimeout=10 <hostName>
where 10 is the number of seconds
回答2:
You can learn much more by typing man ssh
for OpenSSH
command line options and man sshd
for OpenSSH
daemon options...
来源:https://stackoverflow.com/questions/18389367/how-to-decrease-ssh-connection-timeout-value