LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-15-2012, 11:56 AM   #1
cmosentine
LQ Newbie
 
Registered: Feb 2012
Posts: 14

Rep: Reputation: Disabled
Holding open an ftp connection


Hi again: I have my ftp transfer script pretty much done. One thing I don't like about my implementation is I repeatedly open and close the same ftp connection to a target server.

If there a way to open a ftp connection and return the open connection for later reuse?

psuedo-code
open ftp connection
return to main bash script to do some work
send some commnds to the ftp connection
return to main bash script to do some work
send some more commnds to the ftp connection
close the ftp connection
go onto next target server and repeat

Thanks, Chris.
 
Old 02-15-2012, 02:07 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: OpenSUSE 12.1 CentOS 6.2
Posts: 9,012

Rep: Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353
I can't imagine a way to suspend the ftp session and restore it later, but you can execute local shell commands from the ftp session itself. Example:
Code:
ftp -n ftp.something.somewhere <<-EOF
        user username password
        ls
        !ls $HOME
        bye
EOF
Notice the exclamation mark at the beginning of the line in red. It tells ftp to execute the command in the local shell. Shell substitutions will be performed as usual before the whole block of ftp code is executed. Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recoonect ftp without exiting ftp connection ! shipon_97 Linux - Newbie 1 05-05-2009 05:58 AM
2008 not holding wireless connection setting (ndiswrapper) TuxLives Mandriva 8 03-14-2008 04:36 PM
SuSE 9.2 - FTP Port open with no FTP service?!?! don_wombat Linux - Security 12 12-01-2004 03:14 PM
POSTFIX holding mail in qeue, won't deliver, connection refused bentman78 Linux - Software 2 10-27-2004 07:11 AM
ftp connection hariiyer Linux - Networking 1 10-25-2004 01:01 AM


All times are GMT -5. The time now is 05:03 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration