develooper Front page | perl.beginners | Postings from January 2002

using the system function

Thread Next
January 18, 2002 05:14
using the system function
Message ID:
I am trying to scp a file to various systems, but the
script hangs if the scp command to one of the systems
fails.  Is there a way in perl to specify that if the
scp command doesn't work to skip it and continue with
the next system?  I have the following:

use Net::Ping;

@systems = qw(system1 system2 system3);

foreach $system (@systems) {
   $p = Net::Ping->new("icmp");
   next unless $p->ping($system);  

   system("/usr/local/bin/scp file $system:/home");



This works if the system is not reachable.  But if the
system is reachable but it is hung for some other
reason, the script tries to do the scp command which
it won't work.  So the script does not continue.

Any ideas on this would be greatly appreciated.


Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About