CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
FTP from a Telnet session

 



zale1
Deleted

Jun 12, 2001, 8:54 AM

Post #1 of 3 (464 views)
FTP from a Telnet session Can't Post

I had recently asked for help on telneting from one unix box to another. With your help; I'm pleased to say I can now telnet from solaris to an AIX machine. I've also learned that the backslash does not work (in this case) to tell perl that the ! is not a special character. I had to concatenate the ! into my variable in order for it to work.

What I'm trying to do now is to ftp back, in order to send some data.

I show the "print" command in the following lines. I've also tried the "cmd" command, and even the "waitfor" command. This program goes through all the way without any errors, however, I know that I'm not logging into the machine (the FTP session) because I cannot see any additional processes opened when I do the "who" command.


use lib '/lib/perl/5.00503';
use Net::Telnet;
$t = new Net::Telnet (Timeout=> 15);
$root=root;
$login1="Howdy"."\!a";
$login2="Play"."\!hard";
$| = 1;
$\="\n";
$t->open('zale1.com');
$t->login(root, $login1);
$t->cmd ('rm lines.log');
$t->cmd ('ls >> lines.log');
$t->cmd('ftp');
$t->print ("open chavin.com");
$t->print ("root \n");
$t->print ("$login2 \n");
$t->print("cd /data \n");
$t->print("bin \n");
$t->print ("put lines.log \n");
$t->print("bye \n");
$t->print("exit \n");

For this line
$t->print ("open chavin.com");
I've also tried
$t->open ("chavin.com");
$t->cmd ("open chavin.com");

$t->waitfor('/ftp> $/i);

The only line that worked without an error was the print statement and only after I enter the \n

My main goal is to telnet to another machine, get some data and ftp it back to the machine that I ran my perl script from.

Any ideas?
Thanks




sigma
stranger

Jun 13, 2001, 8:15 AM

Post #2 of 3 (459 views)
Re: FTP from a Telnet session [In reply to] Can't Post

Weird solution, very weird...
Why don't You use Net::FTP module?
Try it, I am sure it helps.

http://tlc.perlarchive.com/articles/perl/ls0001.shtml#net::ftp

--
for ($!=0;$!<123;$!++) { print "$!\n"; }

(This post was edited by sigma on Jun 13, 2001, 7:36 AM)


zale1
Deleted

Jun 13, 2001, 10:13 AM

Post #3 of 3 (456 views)
Re: FTP from a Telnet session [In reply to] Can't Post

Would Net::FTP allow me to access another machine (I know it will, but) can I get into a DB2 session, get data from that and bring it back to my original machine?

What I'm trying to do is log onto another unix machine, su to db2, and the list the active application (list applications) from here I would store the information in a log file (text file). Then I need to retrieve it back to the machine I orginally ran the perl script.

Thanks


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives