I have a script that loops through a file of ip addresses and pings them. If the ping is successful, it rsh's to the machine and runs a command. I am using Net-Rsh-0.02. Here is some debug output: Errno::EADDRINUSE(/usr/local/perl/5.6.1/lib/5.6.1/sun4-solaris/Errno.pm:153): 153: sub EADDRINUSE () { 125 } DB<1> Errno::FETCH(/usr/local/perl/5.6.1/lib/5.6.1/sun4-solaris/Errno.pm:182): 182: $errno = 0 unless $! == $errno; DB<1> Errno::FETCH(/usr/local/perl/5.6.1/lib/5.6.1/sun4-solaris/Errno.pm:184): 184: return $errno; DB<1> Net::Rsh::rsh(/usr/local/perl-v5.6.1/lib/site_perl/5.6.1/Net/Rsh.pm:42): 42: if($!{EADDRINUSE}) { DB<1> Carp::croak(/usr/local/perl/5.6.1/lib/5.6.1/Carp.pm:119): 119: sub croak { die shortmess @_ } DB<1> Carp::shortmess(/usr/local/perl/5.6.1/lib/5.6.1/Carp.pm:109): 109: { local $@; require Carp::Heavy; } # XXX fix require to not clear $@? DB<1> Carp::shortmess(/usr/local/perl/5.6.1/lib/5.6.1/Carp.pm:109): 109: { local $@; require Carp::Heavy; } # XXX fix require to not clear $@? DB<1> Carp::shortmess(/usr/local/perl/5.6.1/lib/5.6.1/Carp.pm:109): 109: { local $@; require Carp::Heavy; } # XXX fix require to not clear $@? DB<1> Carp::shortmess(/usr/local/perl/5.6.1/lib/5.6.1/Carp/Heavy.pm:247): 247: 1; Seems like rsh is running out of available ports to use? Here is some code
sub runCommands { $a=Net::Rsh->new(); $host="$ip"; $local_user="root"; $remote_user="root"; $cmd="/home/admin/master/pushout/scripts/$program"; if ( defined($a) ) { $status = $a->rsh($host,$local_user,$remote_user,$cmd); if ( ! defined($status) ) { $msg = $rsh->errmsg; print "\t$msg\n"; print LOG "\t$ip\t$msg\n"; $rsh->close; } else { print PING "$ip $hostname\n"; # Run the program $a->rsh($host,$local_user,$remote_user,$cmd); sleep 1; } } else { print "\t$ip\tConnection refused.\n"; print LOG "\t$ip\tConnection refused.\n"; } }
Any ideas? It barfs after successfully rsh'ing to 5 hosts.

In reply to Rsh dies with EADDRINUSE by jgiller

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.