Ningappa Sullalli wrote:
> Hello,
> I want to write the perl script which perfoms the following activities.
> 1. Telnet to the Solaris machine from WinXP machine.
> 2. Execute the command and move the out put of the command to a file.
> 3. Get back the output files to my local machine.
>  
> I tried with the FTP module(Net::FTP), could not able to run the linux
> command on ftp prompt.
>  
> Can I do it with help of Telnet module?
>  
> Thanks & Regards,
>         Nings
>
>   
Here is what I did, worked on AIX, HP...
I wanted to run the same command on multiple systems so I had a loop 
hence the next if the telnet failed.
The result of the command is returned so I did not need to get a file 
after running the command.

    use Net::Telnet();
    :
    :
      next unless $t = new Net::Telnet( Prompt => '/[\$%#>]\s*$/', 
Timeout => 500);
      next unless $t->open(Host => $systems[$i][0]) or warn " ";
      next unless $t->login(Name => $user, Password => $passwd) or warn " ";
      @results = $t->cmd('') or warn " ";
      @results = $t->cmd('PS1="$ "') or warn " ";
      @results = $t->cmd($cmd) or warn " - command failed: ";
      $rc = $t->close;

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to