Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Starting another programme from mod_perl

by jdtoronto (Prior)
on Apr 02, 2004 at 19:40 UTC ( [id://342102]=perlquestion: print w/replies, xml ) Need Help??

jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks,

I have need to 'spawn' an external Perl process from within a CGI::Application based web-app under mod_perl.

I cannot figure out how to 'run and detach'. I need to pass a list to the external programme then have it just go off and do its thing. It may take some hours for its work to be done. It can report via a log file or a semaphore file, I do not want to wait for it to return.

How do I do this?

jdtoronto

  • Comment on Starting another programme from mod_perl

Replies are listed 'Best First'.
Re: Starting another programme from mod_perl
by matija (Priest) on Apr 02, 2004 at 19:53 UTC
    You could just fork it off like this:
    unless (fork) { exec("/some/long/running/program"); # exec never returns here }
      That may cause issues... you may need to close STDOUT as well, and possibly STDERR. I know you need to do this from a CGI, otherwise the child can cause the process to stay open.

      It seems there is also a call to detach a process from a process group, just for an extra measure of independance, but I don't remember what that call is.

                      - Ant
                      - Some of my best work - (1 2 3)

Re: Starting another programme from mod_perl
by BUU (Prior) on Apr 02, 2004 at 22:01 UTC
    Back ticks and background? `/my/long/process &`;
Re: Starting another programme from mod_perl
by edoc (Chaplain) on Apr 03, 2004 at 13:27 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://342102]
Approved by bassplayer
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-25 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found