Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I got data on a private FTP server I want to mirror it, but "on demand". My frontend is an Apache/PHP server...

Here's the flow :

  • Clients asks the apache server for a file
  • if file is not on hdd, download it from the ftp server. (stream it to client, while saving it to hdd)
  • send file to client (from apache)

I don't know exactly how to proceed...

Is there a way to stream a file while downloading it ?

Maybe we could do something with php/curl...

share|improve this question
    
The question is unclear; should the clone be initiated by a request on the primary server, or the secondary server, or either ? From where to where should it be cloned - from a dedicated FTP server to a web server, or vice versa ? Enumerate the actors and provide a clear flow description. –  adaptr Apr 26 '12 at 14:45

1 Answer 1

Try LftpFS: http://lftpfs.sourceforge.net/

It's a FUSE filesystem that relies on lftp as a backend and does exactly what you need. It requires a basic lftp script, but it's easy to write one. The official site provides sufficient info.

You can also try and turn your Apache into a caching proxy, that would work too (and probably faster than FUSE).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.