LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
  Search this Thread
Old 02-06-2007, 02:12 PM   #16
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239

try using your .netrc file to automate a macro
man netrc
 
Old 02-11-2007, 02:17 AM   #17
HSN
LQ Newbie
 
Registered: Dec 2006
Distribution: Ubuntu
Posts: 25

Original Poster
Rep: Reputation: 15
Still my script hangs!
 
Old 02-11-2007, 02:53 AM   #18
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Can you post the last version of your script? Thx
 
Old 02-11-2007, 03:18 AM   #19
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by HSN
jlliagre
what benefit do I obtain from wget?
A simple, one-liner working solution.
 
Old 02-11-2007, 03:58 AM   #20
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hello friends!

I suggest you to look at commands you actually send to the server and at server's reply with the help of `ngrep' utility.

The problem might be a lost of synchonization between FTP client and server caused by slow network connection or smth like. For example when you say 'USER <username>' ftp server should respond:
Code:
331 Password required for <username>.
and if you send 'PASS <passwd>' before you caught 331 reply then FTP server will wait your password forever (or until timeout). Theoretically

If this is the case, you may use `sleep N' bash command between FTP commands or use more complicated strategy of waiting for server replies (see for example `email' script at http://tiocu.svn.sourceforge.net/vie...=2&view=markup).

Hope, this is unuseful for you and the problem can be solved in less complicated way!

Bye.
 
Old 02-11-2007, 06:24 AM   #21
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
A less complicated way that would be, for example:
Code:
wget ftp://$username:$password@$host/$file
If you need to interact with ftp a more complicated way, then either the "expect" command or ksh co-processes would work.

Here documents (<<) aren't robust enough for a reliable solution.
 
Old 02-11-2007, 10:26 PM   #22
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
The benefit you get from wget is the simplicity of use. wget uses a single command line, and then gets the stuff. ftp requires that you emulate a person typing in a series of commands.
 
Old 02-12-2007, 03:01 AM   #23
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
true, wget is better but often in a working environment you are stuck with ftp.
jiliiagre is right, << documents are no good.
ftp is a pain to automate, i've tried extensively before.
 
Old 02-13-2007, 02:05 AM   #24
HSN
LQ Newbie
 
Registered: Dec 2006
Distribution: Ubuntu
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks guys for you help.
I'm trying wget on Windows and MAC. I think I'll use this instead of ugly ftp.

Thanks a lot.
 
Old 02-23-2007, 03:18 PM   #25
telamonides
LQ Newbie
 
Registered: Feb 2007
Posts: 5

Rep: Reputation: 0
Never mind!

Last edited by telamonides; 02-23-2007 at 06:04 PM. Reason: figured answer out
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto ftp shell script mcrosby Linux - Newbie 9 06-27-2007 06:09 AM
shell script to transfer file from ftp bbgtilak Linux - General 1 12-27-2006 07:35 AM
shell script for ftp javier_ccs Programming 7 07-18-2006 11:02 PM
Automating FTP upload via a shell script? Spitty Programming 5 01-16-2006 10:28 PM
Trouble when automating ftp with shell script hari_s_82 Linux - Newbie 2 09-23-2004 02:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:29 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration