in reply to How do I start a long process with a short visit to a URL?
Something like this:
Now, granted, I missed a bunch of error conditions around fork, as well as omitting the Highlander Maneuver, but that's the basic idea.if (fork() == 0) { close STDIN; close STDOUT; close STDERR; do_long_running_thing(); exit 0; } print_out_web_response();
Note that you can reopen stdout and/or stderr and redirect them to a file, or you can pipe them into something that'll send you an email, whatever you want. If nothing else, you may want to reopen to /dev/null, just to sure you don't confuse subprocesses if you call any.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I start a long process with a short visit to a URL?
by ikegami (Patriarch) on Oct 07, 2009 at 23:58 UTC |