ssh timeout

Howard, Chris HowardC at prpa.org
Fri Sep 25 15:16:47 UTC 2009


You can kill a child process after a certain time
has elapsed.

So, you would have a parent shell script start
up the ssh script and put it in the background (&).
Then call sleep for some
number of seconds.  When it wakes up if the
child is still running ('kill -0 $pid')
then you send it a kill signal ('kill -9 $pid').
Use a file in /tmp for the child to pass back results
to the parent process if it succeeds.

Or, I think you could use a timeout signal
in a perl script.

Or, I think you could have the remote machine
use ssh to put its information  onto a central
monitoring machine periodically using cron or
similar.  Then your monitoring program would
just look at that centralized information and
not do an ssh at all.



> -----Original Message-----
> From: nitin.gizare at wipro.com [mailto:nitin.gizare at wipro.com]
> Sent: Thursday, September 24, 2009 8:17 PM
> To: redhat-sysadmin-list at redhat.com
> Subject: ssh timeout
> 
> HI
> 
> 
> 
> I am running script using ssh to capture load of some parameters of
> remote machine.
> 
> But if one of machine is down script does not go forward and will be
> waiting for to come up and complete ssh connections.
> 
> I would like to set some time out in which case if machine does not
> response it should time out on ssh and proceed for next steps.
> 
> 
> 
> Please help me with this settings
> 
> 
> 
> Rgds
> 
> Nitin





More information about the redhat-sysadmin-list mailing list