How to do ssh with a timeout in a script?

后端 未结 6 1355
野趣味
野趣味 2020-12-12 11:17

I\'m executing a script connecting via password-less SSH on a remote host. I want to set a timeout, so that if the remote host is taking an infinite time to run, I want to c

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 11:34

    ssh -o ConnectTimeout=10  
    

    Where 10 is time in seconds. This Timeout applies only to the creation of the connection.

提交回复
热议问题