PDA

View Full Version : Terminal FTP "invalid arguments"




wesg
May 24, 2008, 10:55 PM
I'm writing a bash script that eventually will upload to my website, and I've run into a problem with the FTP element.

Whenever I login with the command
ftp ftp://user:password@www.example.com

I get the response Invalid number of arguments, and it disconnects me. What am I doing wrong?



telecomm
May 25, 2008, 05:44 AM
It's been a while since I've done anything ftp related from terminal, but I think you just want 'ftp username@location' (so try it without the 'ftp://' bit).

wesg
May 25, 2008, 12:02 PM
I've solved one problem, but now I need to build in error detection. My script will be running with crontab every hour, but if I'm not connected to a network, I don't want it to hang. How can I set a timeout so the script continues after, say, 5 seconds of nothing?

set timeout 10 ?

shadowfaux
May 25, 2008, 11:59 PM
I've solved one problem, but now I need to build in error detection. My script will be running with crontab every hour, but if I'm not connected to a network, I don't want it to hang. How can I set a timeout so the script continues after, say, 5 seconds of nothing?

set timeout 10 ?

I think the -q option to ftp will do the trick:

ftp -q 30 ftp://user:pass@host:port/


but the man page reads "Quit if the connection has stalled for quittime seconds." so it may only start counting after a connection is made.