Re: Forcing SSH to timout after a certain time if it isn't responding
From: Nikolay Arbuzov (narbuzov_at_att.com)
Date: 11/19/03
- Next message: Nikolay Arbuzov: "Re: X11 forwarding in OpenSSH question"
- Previous message: Darren Dunham: "Re: Forcing SSH to timout after a certain time if it isn't responding"
- In reply to: Darren Dunham: "Re: Forcing SSH to timout after a certain time if it isn't responding"
- Next in thread: andy: "Re: Forcing SSH to timout after a certain time if it isn't responding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 19 Nov 2003 13:57:12 -0500
If ou have older version of ssh which does not support ConnectTimeout
you can sleep for 1 second and depend on what type of
Unix you have check /proc/<pid> or do `ps -p <pid>'.
And if process gone break out from the loop. This
will save you some time ( 1 sec) in your case.
while sleep 1; do
[[ ! -d /proc/$pid ]] && { break 1; }
done
"Darren Dunham" <ddunham@redwood.taos.com> wrote in message
news:Rgyub.6710$3E7.55264382@newssvr21.news.prodigy.com...
> In comp.security.ssh andy <andy@wpi.edu> wrote:
> > Hi,
>
> > I'm wiritng a Bash script where I want to check if I can SSH into a
> > certain IP-address in a function. If the SSH call does nto respont for
> > 2 seconds I want to kill the process, but if it responds before 2
> > seconds then it
> > shudnt have to wait unnecessarily for 2 seconds.
>
> > here the code i was trying:
>
> [snip]
>
> Why not just specify the connection timeout?
>
> > `ssh -q "$1" /bin/true &> /dev/null &`
>
> Note that -q turns off messages, but it does not prevent the client from
> asking necessary interactive questions... You'd need BatchMode for that.
>
> ssh -o BatchMode=yes -o ConnectTimeout=2 /bin/true > /dev/null
>
> --
> Darren Dunham ddunham@taos.com
> Unix System Administrator Taos - The SysAdmin Company
> Got some Dr Pepper? San Francisco, CA bay area
> < This line left intentionally blank to confuse you. >
- Next message: Nikolay Arbuzov: "Re: X11 forwarding in OpenSSH question"
- Previous message: Darren Dunham: "Re: Forcing SSH to timout after a certain time if it isn't responding"
- In reply to: Darren Dunham: "Re: Forcing SSH to timout after a certain time if it isn't responding"
- Next in thread: andy: "Re: Forcing SSH to timout after a certain time if it isn't responding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|