The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FTP is broken. How can I upload like cPanel does?

Discussion in 'General Discussion' started by jerrykrinock, Nov 2, 2012.

  1. jerrykrinock

    jerrykrinock Member

    Joined:
    Nov 2, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I live in California and own a site hosted in Texas. Every month or so, I need to upload a large file and I want to do it in automatically, in a script. So I script the ftp command-line program. This worked until the last year or so, when some server between my office and Texas decided to time out the FTP command channel after 60 seconds. This causes ftp to exit with failure. Also, about 10% of the time, I find that the upload was incomplete.

    Although I've solved the first problem by ignoring the error and downloading the file to verify, the only solution to the second problem is to retry and hope.

    Whenever I'm editing my site manually, I use cPanel which is provided by my web host. cPanel is wonderful. I can upload large files using cPanel's File Manager and it always works. Could someone please guess or tell me what cPanel's File Manager uses under the hood to upload files? I'd like to rewrite my script to use the same thing.

    Thank you,

    Jerry Krinock
     
  2. jerrykrinock

    jerrykrinock Member

    Joined:
    Nov 2, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Just some more information. I got sleepless, found and tried another command-line FTP client, /http://www.ncftp.com/ncftp/doc/ncftpput.html. Result: It behaves the same as the ftp which comes with Mac OS X. After a multi-minute upload, it stalls for another minute or two, and then tells me that the control channel timed out.

    So I think it's not the ftp client but the FTP protocol which is not a reliable protocol. What other options are there for scriptfully uploading a large file to a server running cPanel?
     
  3. arunsv84

    arunsv84 Well-Known Member

    Joined:
    Oct 20, 2008
    Messages:
    373
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    127.0.0.1
    cPanel Access Level:
    Root Administrator
    Try switiching passive and active mode while using FTP. Are you behind some firewall? Also please provide the exact error message here.

    Cheers!!!
     
  4. jerrykrinock

    jerrykrinock Member

    Joined:
    Nov 2, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thank you, arunsv84. I'm not behind any firewall that I know of, unless something is built in to Mac OS X. If anyone knows how to test for a firewall, let me know and I'll try it.

    Here is the console output I get when ftp fails…
    229 Extended Passive mode OK (|||31183|)
    150 Accepted data connection
    100% |*********************************************************| 2324 KiB 39.45 KiB/s 00:00 ETA
    421 Service not available, remote server timed out. Connection closed.
    2380531 bytes sent in 01:58 (19.54 KiB/s)


    And here is the console output I get when ncftpput fails…
    /Users/jk/Uploads/junk.junky: ETA: 0:00 13.53/ 13.53 MB 39.35 kB/s -Could not read reply from control connection -- timed out.
    /Users/jk/Uploads/junk.junky: 13.53 MB 28.42 kB/s
    ncftpput /Users/jk/Uploads/junk.junky: could not send file to remote host.


    I've read that there is some setting deep down in some Linux systems which can tell the system to ignore timeouts in the FTP command channel, which would fix or maybe work around this problem, but that setting is not implemented in Mac OS X.

    Although it's not common, in working on this problem over the last year I have found others with the same issue, although most others get several minutes instead of only 60 seconds as I do. I recognized that this underlying issue was also causing annoying re-uploads of large files with a commercial website editor app which I use, /http://www.karelia.com/sandvox/ Sandvox. A couple other Sandvox users chimed in with the same problem in this //http://www.karelia.com/forum/viewtopic.php?id=2303 forum thread. One of Sandvox' engineers, Mike Abdullah, who is way smarter than me, worked on the problem, confirmed that it was caused by command channel timeouts, and after some research told me privately that the only solution was to ignore the command channel timeout, and I think this was the solution he implemented in Sandvox as a bug fix.
     
Loading...

Share This Page