ssh timeout
nitin.gizare at wipro.com
nitin.gizare at wipro.com
Fri Sep 25 16:46:33 UTC 2009
HI
Thanks but, some time I see that we can ping machine but server is hung state in which case I can not run ssh or can not connect at all.
in such cases my script just stops and wating for host to respond
Rgds
Nitin
________________________________
From: redhat-sysadmin-list-bounces at redhat.com on behalf of Ben Kevan
Sent: Fri 9/25/2009 2:21 PM
To: redhat-sysadmin-list at redhat.com
Subject: Re: ssh timeout
On Fri, 25 Sep 2009 02:16:34 -0000, <nitin.gizare at wipro.com> wrote:
> 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
>
I think everyone missed his point.. he didn't want ssh timeouts.. the
original request is:
"But if one of machine is down"
So what you want is to do a ping to the machine, if ping fails then don't
run the script:
ping -c 1 -w 1 $SERV 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
Run the code you want to run
else
echo "$SERV is not up"
fi
--
If you don't know what you want, you end up with a lot you don't. -Fight
Club
--
redhat-sysadmin-list mailing list
redhat-sysadmin-list at redhat.com
https://www.redhat.com/mailman/listinfo/redhat-sysadmin-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/redhat-sysadmin-list/attachments/20090925/9ef90b84/attachment.htm>
More information about the redhat-sysadmin-list
mailing list