water has asked for the wisdom of the Perl Monks concerning the following question:
I'd like this to be fired off from a Mason page (modperl2, apache2). This is not on a public site, and foo& is benign, and foo is smart enough not run multiple copies of itself.foo&
Is
a reasonable way to invoke a backgrounded foo from a Mason page, or is something more complicated needed? If so, why?system('/path/to/foo&');
Thanks
the setsid solution offered below worked fine for me, once I got over a simple (but for me hard-to-find) bug: foo& worked fine from a command line, but wasn't working from w/in mason/apache/modperl because the system had neglected to set a slew of required environment variables. Once I figured that out, and included an appropriate source
then all worked great.my $rc = system("source /path/to/.profile; setsid /path/to/foo &");
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: apache2 and system
by etcshadow (Priest) on Sep 28, 2004 at 01:40 UTC | |
by sgifford (Prior) on Sep 28, 2004 at 02:59 UTC | |
by etcshadow (Priest) on Sep 28, 2004 at 03:09 UTC | |
by water (Deacon) on Sep 28, 2004 at 01:46 UTC | |
|
Re: apache2 and system
by bsdz (Friar) on Sep 28, 2004 at 07:15 UTC | |
|
Re: apache2 and system
by nite_man (Deacon) on Sep 28, 2004 at 07:04 UTC | |
|
Re: apache2 and system
by water (Deacon) on Sep 28, 2004 at 04:07 UTC |