Terminal FTP "invalid arguments"

Discussion in 'Mac Programming' started by wesg, May 24, 2008.

  1. wesg macrumors regular

    wesg

    Joined:
    Jan 2, 2008
    Location:
    Toronto, ON
    #1
    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
    Code:
    ftp ftp://user:password@www.example.com 
    I get the response Invalid number of arguments, and it disconnects me. What am I doing wrong?
     
  2. telecomm macrumors 65816

    telecomm

    Joined:
    Nov 30, 2003
    Location:
    Rome
    #2
    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).
     
  3. wesg thread starter macrumors regular

    wesg

    Joined:
    Jan 2, 2008
    Location:
    Toronto, ON
    #3
    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?

    Code:
    set timeout 10
    ?
     
  4. shadowfaux macrumors newbie

    Joined:
    May 19, 2008
    #4
    I think the -q option to ftp will do the trick:
    Code:
    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.
     

Share This Page