"Stephen O'D" <> wrote:
> I have a script that asks for some input on several screens, and at the
> end it kicks off a connection to a database which does some work that
> could potentially take a long time. I dont want to hold up displaying
> the webpage while this is running - I would prefer to print a message
> to the browser saying the job is running in the background. In other
> works, I want to allow the script to continue running, but notify the
> browser that I have finished talking to it.
>
> I found a script written by Randal Schwartz that says todo this all you
> have todo is close STDIN and STDOUT:-
>
> open STDIN, "</dev/null";
> open STDOUT, ">/dev/null";
>
> However when I do this the script seem to die (although no die message
> gets into the error logs - it just seems to give up silently).
Apache, and probably other web servers, will kill the CGI process once
the process closes STDOUT and STDERR. That is probably why your script
is dying. Either reconfigure the server not to do this (I don't know how
to do that) or fork a new process to do the heavy lifting so that the
original process can go away gracefully.
> Also, a
> system command to copy a file gives an error "Not A Typewriter". If I
> remove the system command, the database connection does not work
> correctly (it seems to work sometimes though??!!).
Sorry, I can't make sense of this. Can you show the relevant code?
> How can I 'disconnnect' the browser let my script continue todo some
> work? I would prefer not to fork.
I'd prefer to stop aging, but that isn't working out for me, either
Xho
--
--------------------
http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB