Need help on Telnet to Linux(Solaris SPARC) machine

Need help on Telnet to Linux(Solaris SPARC) machine

am 17.06.2008 05:57:06 von Ningappa Sullalli

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



DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited.
E-mail may contain viruses. Before opening attachments please check them for viruses and defects. While MindTree Limited (MindTree) has put in place checks to minimize the risks, MindTree will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.
Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
MindTree reserves the right to monitor and review the content of all messages sent to or from MindTree e-mail address. Messages sent to or from this e-mail address may be stored on the MindTree e-mail system or else where.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Need help on Telnet to Linux(Solaris SPARC) machine

am 17.06.2008 06:13:43 von basil.daoust

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