tprizler has asked for the wisdom of the Perl Monks concerning the following question:

Hi all respected monks,

I have this problem with a script I wrote tha use net::telnet

I am trying to copy a big file from the net (1G), and installing it on 50 solaris machines..

The thing is I don't know how to do it simultaneously, because each installtion takes 2 hours at least.

Is there any way I can improve my sript to be able to send those comands to the machines and move to the nect machine without realy waiting until the installation will finished??

Thanks all!!

Replies are listed 'Best First'.
Re: net::telnet problem
by zentara (Cardinal) on Jan 11, 2009 at 18:02 UTC
      Good call zentara, tho' I suspect that SSH may be overkill - I'm sure the OP would have mentioned it if it were a factor - even so, it's good to have all bases covered sooner rather than later :-)

      A user level that continues to overstate my experience :-))
        Hi, yes, the general wisdom is to avoid telnet anymore, unless you are sure you are on a secure network. Installing to 70 servers, probably requires root access, which would be bad to pass those passwords over a network.....even a local net....who knows who is snooping.

        Even with ssh, they usually disallow root ssh logins, so the method is to login with a user thru ssh, then su to root....that way, it's all encrypted network trafffic.


        I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: net::telnet problem
by Bloodnok (Vicar) on Jan 11, 2009 at 17:57 UTC
    Do you have to use your script - far more efficient would be something along the lines of...
    1. Put the file on a file system on a local host that is/can be exported (via NFS) to all intended remote client machines (to save copying time)
    2. NFS mount(1M) the exported file system on each remote client machine
    3. Run the install on each remote client machine
    The latter 2 steps could be achieved in parallel, in sh(1), in a manner similar to...
    for M in M1 ... Mn ; do rsh $M "nohup mount <source mc>:/<export fs> /import/fs ; /<import + fs>/install " & done
    I'm inferring that, since you have permissions to install on the remote machines, you have permissions to run mount(1M) - and to create the mount point(s) on the remote client machines (if needed).

    A user level that continues to overstate my experience :-))
Re: net::telnet problem
by eye (Chaplain) on Jan 11, 2009 at 21:47 UTC
    (1) If this is a recurring issue, you might want to consider tools like cfengine and puppet, which are designed to automate system administration tasks for large numbers of machines.

    (2) If doing 50 concurrent file transfers causes unacceptable network congestion, you might consider using the bit torrent protocol to distribute the file internally from a local server (like Bloodnok's suggestion, but with a different protocol). Bit torrent is effectively cooperative so that the entire 50 GB does not have to come from a single source (host).

    (3) Finally, let me pile on the anti-telnet bandwagon. It is simply a bad idea to run a telnet server in most circumstances. If ssh seems to have too great an overhead, you can greatly reduce its overhead by using a weaker cipher (eg, "ssh -c arcfour hostname"). This does not affect the protection given to the authentication mechanism.

      If ssh seems to have too great an overhead, you can greatly reduce its overhead by using a weaker cipher (eg, "ssh -c arcfour hostname"). This does not affect the protection given to the authentication mechanism.

      That's a helpful piece of advice. For which I'd ++ you twice...


      Life is denied by lack of attention,
      whether it be to cleaning windows
      or trying to write a masterpiece...
      -- Nadia Boulanger
Re: net::telnet problem
by salva (Canon) on Jan 11, 2009 at 22:08 UTC
    You my find Net::OpenSSH useful:
    use Net::OpenSSH 0.16; my %ssh; $ssh{$_} = Net::OpenSSH->new($_, async => 1) for @hosts; my %log; open $log{$_}, '>', "/tmp/install-$_.log" for @hosts; my @pids = map $ssh{$_}->scp_put({stderr_fh => $log{$_}, stdout_fh => $log{$_}, async => 1}, $local_fn, $target), @hosts; waitpid($_, 0) for @pids; @pids = map $ssh{$_}->spawn({ stdout_fh => $log{$_}, stderr_fh => $log{$_} }, "remote command..."), @hosts; waitpid($_, 0) for @pids;