in reply to Re: FTP in TELNET
in thread FTP in TELNET

Hi,

Sorry i was just so excited about getting replies ;)

Okay ..

I have created a script to telnet into a remote server and ftp from that remote server. (this would be tier1)
I would also need to telnet from the tier1 server to another server (tier2) and ftp that same file to the tier3 server.

I am able to telnet in telnet, that works fine .. it is just the ftp'ing that i am having hassels with.

Thank you so very much for your replies ;)

Regards

Spyda

Replies are listed 'Best First'.
Re^3: FTP in TELNET
by jhourcle (Prior) on Sep 21, 2005 at 14:45 UTC

    Maybe I'm reading your message incorrectly, but your labeling of the systems seems rather confusing (is tier1 the webserver running the CGI, or the host that you're telneting to?)

    I'm going to go with the assumption that you're dealing with:
    • tier1 : webserver, running the CGI.
    • tier2 : allows telnet from tier1, has the file of interest.
    • tier3 : allows ftp from tier2, needs the file of interest.

    Given that, I'd go with one of the following:

    1. Continue on with the processes that you've started. Basically, you'd use the same 'waitfor' and 'print' in Net::Telnet to send the necessary commands to transfer the file between tier2 and tier3. If available, I'd recommend looking into using scp over FTP, just because the command is more easily scriptable. (rcp is another possibility, if security isn't an issue). You might also look into Expect for some better error handling in the connection
    2. If tier2 has FTP or some other form of file transfers available, and tier3 allowed FTP in from tier1, and the file is allowed on the network connected to tier1, I'd use Net::FTP to pull the file from tier2 to tier1, then push it up to tier3.
    3. If tier2 and tier3 allowed scp in from tier1, I'd use it instead (I've never used it to move between two remote systems, but the man page seems to suggest that's possible)