Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How do I start a long process with a short visit to a URL?

by Tanktalus (Canon)
on Oct 07, 2009 at 23:03 UTC ( #799833=note: print w/ replies, xml ) Need Help??


in reply to How do I start a long process with a short visit to a URL?

Something like this:

if (fork() == 0) { close STDIN; close STDOUT; close STDERR; do_long_running_thing(); exit 0; } print_out_web_response();
Now, granted, I missed a bunch of error conditions around fork, as well as omitting the Highlander Maneuver, but that's the basic idea.

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.


Comment on Re: How do I start a long process with a short visit to a URL?
Download Code
Re^2: How do I start a long process with a short visit to a URL?
by ikegami (Pope) on Oct 07, 2009 at 23:58 UTC
    The details you say you don't handle? The module I mentioned does. It does the STDOUT/STDERR redirecting too if you wish.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://799833]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-09-22 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (207 votes), past polls