> -----Original Message-----
> From: Thind, Aman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, February 04, 2004 10:25 PM
> To: [EMAIL PROTECTED]
> Subject: Remote script execution
> 
> 
> Hello Friends,
> 
> I would be really grateful if someone could help me out with this.
> 
> I want to write a script that when executed will get lots of 
> details from 10
> different Unix(AIX) and Windows(XP) boxes and generate a report.

        As Wolf pointed out, this can get complex.  Here's some code that
ssh's to a remote machine, runs a little script "/usr/newPort/addOne.pl"
(not shown) to add one to a number in a file "portNum" on the remote
machine, then ssh's to the machine again and uses "cat" to assign the new
number in the file to a variable $port for the script on the local machine.

qx/\/usr\/bin\/ssh -n -l root 172.26.10.10 'perl
\/usr\/newPort\/addOne.pl'/;
$port = qx/\/usr\/bin\/ssh -n -l root 172.26.10.10 'cat
\/usr\/newPort\/portNum'/;
chomp $port;
        
        Please investigate the difference between "qx" and "system"-- they
are not the same.  For the first example above, either would work; for the
second, only "qx" will work. That you need to capture information leads me
to think you probably need "qx", but I could be wrong. For "ssh" and "perl"
and "cat" in the examples above, substitute whatever you need to do to get
your information on the remote machines.
        I hope that's enough information to get you started...
-Chris   
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to