in reply to webserver independent script

I may be wrong about this, but perhaps if you are on Unix you could fork() a new process to do the ftp stuff?

if ( fork() ) {exit} else { # ftp stuff }

However, perhaps webservers kill all children at timeout too. Not sure.

David

Replies are listed 'Best First'.
Re: Re: webserver independent script
by LiTinOveWeedle (Scribe) on May 10, 2001 at 15:55 UTC
    Thx,
    last sentece is good question. I look at Web techniques Column 20 - Merlyn using fork for two proceses to: 1) redirect to some URL and 2) run long time process (in this case it's search routine) so I think it should work. - so that webserver don't kill child process, hope.

    Any suggestion?

    Li Tin O've Weedle
    mad Tsort's philosopher

      I had this problem in Web-FTP you need to fork and close STDOUT;

      at least, you need to close STDOUT if you want apache to tell the page the browser is done. I do a...

      fork() && exit(0); close STDOUT;
      which allows the browser to go on its merry way.
                      - Ant
Re: Re: webserver independent script
by LiTinOveWeedle (Scribe) on May 24, 2001 at 11:20 UTC
    At least I realized that under win32 you must use system() or exec() commands after forking, to create independent process. So, at first fork, then daemonize child process (close STDIN and STDOUT) and then use system() or exec() to call part of code. This work well in my case and I hope it will work well in yours.

    Thanks to other monks who helped me to find out this problem.

    Li Tin O've Weedle
    mad Tsort's philosopher