How to skip a ssh command that hangs in a batch script? - SSH

This is a discussion on How to skip a ssh command that hangs in a batch script? - SSH ; Hi, I run ssh in batch mode. I have a central server and from that system I can run a command on every server across the landscape using a script that just runs each ssh in turn, running the next ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: How to skip a ssh command that hangs in a batch script?

  1. How to skip a ssh command that hangs in a batch script?

    Hi,

    I run ssh in batch mode. I have a central server and from that system I
    can run a command on every server across the landscape using a script
    that just runs each ssh in turn, running the next one after the
    previous one has completed. We have about 100 servers here so if I run
    a batch command, I run 100 ssh commands in turn. Occasionally, I find
    that some ssh commands hang. If one ssh hangs, it means the rest ssh
    commands after this one will have to wait for it out of hang. Some of
    the hangs are due to the shut-down of the servers while others due to
    unknown reasons. For whatever reasons, I wonder whether there is way to
    tell a ssh command to stop trying after certain time, say 5 seconds, of
    trying? Thank you for any help.

    Paul.


  2. Re: How to skip a ssh command that hangs in a batch script?


    You don't say what SSH software you're using. If it's OpenSSH, search
    ssh_config(5) for "timeout."

    --
    Richard Silverman
    res@qoxp.net


  3. Re: How to skip a ssh command that hangs in a batch script?

    On Wed, 30 Nov 2005 09:55:09 -0800, paulaugust2003 wrote:

    > I run ssh in batch mode. I have a central server and from that system I
    > can run a command on every server across the landscape using a script
    > that just runs each ssh in turn, running the next one after the
    > previous one has completed. We have about 100 servers here so if I run
    > a batch command, I run 100 ssh commands in turn. Occasionally, I find
    > that some ssh commands hang. If one ssh hangs, it means the rest ssh
    > commands after this one will have to wait for it out of hang. Some of
    > the hangs are due to the shut-down of the servers while others due to
    > unknown reasons. For whatever reasons, I wonder whether there is way to
    > tell a ssh command to stop trying after certain time, say 5 seconds, of
    > trying? Thank you for any help.
    >


    Try using shmux or maybe global - that way you'll be in more control...

    --
    Dave Abbott, UNIX SysAdmin |
    Department of Computer Science | http://www.dcs.shef.ac.uk/
    The University of Sheffield |


+ Reply to Thread