Remsh timeout problem

Remsh timeout problem

am 19.10.2007 17:15:19 von rachit7

Hello Folks,

If I try to remsh to a non-existent ip address, remsh command waits
until it times out (usually 1min approx). Is there a way to kill this
command after waiting for some time ( say 5 secs)? Actually, I have
written a ksh script that remshells to a list of hosts ( reading them
from an input file) and executes a list of commands and gets the
output back to a log file. If any one of these hosts (in the input
file) does not exist then the waiting time for the completion of the
script becomes

time taken by remsh to run all the commands on all the hosts that have
been resolved + time taken by remsh to timeout ( usually 1 min or
more) on a bad hosts (or non-existent hosts).

I want to reduce this time by killing the remsh in between, or just
skipping that host.

Ping is not allowed on the network.

Any other suggestions??? tricks??? Manpage of remsh suggest
gethostbyname() to resolve the hosts. But I dont know how to use
it......not sure if it will work either.

Thanks in Advance,

RB

Re: Remsh timeout problem

am 20.10.2007 18:46:37 von gazelle

In article <1192806919.636411.234090@v23g2000prn.googlegroups.com>,
itsme wrote:
>Hello Folks,
>
>If I try to remsh to a non-existent ip address, remsh command waits
>until it times out (usually 1min approx). Is there a way to kill this
>command after waiting for some time ( say 5 secs)? Actually, I have
>written a ksh script that remshells to a list of hosts ( reading them
>from an input file) and executes a list of commands and gets the
>output back to a log file. If any one of these hosts (in the input

Sounds like you are looking for the "maxtime" script:

#!/usr/bin/expect --
# Usage: maxtime []
set echo ""
if {[lindex $argv 0] == "-q"} {
set echo "-noecho"
set argv [lrange $argv 1 end]
}
set timeout [lindex $argv 0]
if [catch {eval spawn $echo [lrange $argv 1 end]}] {
puts "Usage: maxtime \[-q] \[]"
exit -1
}
if [catch {set exitval $env(MAXTIME_exitval)}] { set exitval -1 }
expect timeout { puts stderr "[lrange $argv 1 1]: Timeout" ; exit $exitval }
exit [lrange [wait] 3 3]