Re: exec and detach a subprocess

2005-02-21 Thread Stas Bekman
Igor wrote: [...] Without the additional fork in "exit if fork() > 0;", background scripts which are started from exec(...) are killed when request is complete. Without the additional fork(), the PID for the bg process will be the same as for the "exec_helper.pl" script (since "exec" is used). Apac

Re: exec and detach a subprocess

2005-02-21 Thread Igor
Message-ID: 873053 On Monday 21 February 2005 10:20, You wrote: Original Message -- Subject: Re: exec and detach a subprocess From: Stas Bekman <[EMAIL PROTECTED]> To: Igor Shevchenko <[EMAIL PROTECTED]> CC: modperl@perl.apache.org Date: 21 Feb 2

Re: exec and detach a subprocess

2005-02-20 Thread Stas Bekman
Igor Shevchenko wrote: A small followup to this case. Looks like mp2 or apache2 are killing background process, by PID; Probably in a cleanup handler for the request. I had to add additional "return if fork() 0;" to the exec_helper.pl script to make bg processes survice. what do you mean by backg

Re: exec and detach a subprocess

2005-02-20 Thread Igor Shevchenko
A small followup to this case. Looks like mp2 or apache2 are killing background process, by PID; Probably in a cleanup handler for the request. I had to add additional "return if fork() > 0;" to the exec_helper.pl script to make bg processes survice. -- Best Regards, Igor Shevchenko

Re: exec and detach a subprocess

2005-02-19 Thread Stas Bekman
Igor Shevchenko wrote: On Saturday 19 February 2005 18:51, you wrote: please check one more thing where is your cwd in the spawned script, it should be '/'. in mp1 one had to manually chdir '/' in the script, but I believe the Apache C API called from spawn_proc_prog does it for you. Is that right?

Re: exec and detach a subprocess

2005-02-19 Thread Igor Shevchenko
On Saturday 19 February 2005 18:51, you wrote: > please check one more thing where is your cwd in the spawned script, it > should be '/'. in mp1 one had to manually chdir '/' in the script, but I > believe the Apache C API called from spawn_proc_prog does it for you. Is > that right? Checked, it w

Re: exec and detach a subprocess

2005-02-19 Thread Stas Bekman
Igor Shevchenko wrote: [...] exec ( @ARGV ); why do you need to call exec() here? It doesn't detach if you don't call it? I think it should make no difference at all. I need to run the real script somehow, hence the call to "exec". yes, of course, so this was just a wrapper. But you end up with ye

Re: exec and detach a subprocess

2005-02-19 Thread Igor Shevchenko
On Saturday 19 February 2005 18:44, you wrote: > Igor Shevchenko wrote: > > On Saturday 19 February 2005 03:06, Stas Bekman wrote: > >>What about? > >>$r->spawn_proc_prog > >>http://perl.apache.org/docs/2.0/api/Apache/SubProcess.html#C_spawn_proc_p > >>ro g_ > > > > Thanks for those links, Stas! I

Re: exec and detach a subprocess

2005-02-19 Thread Stas Bekman
please check one more thing where is your cwd in the spawned script, it should be '/'. in mp1 one had to manually chdir '/' in the script, but I believe the Apache C API called from spawn_proc_prog does it for you. Is that right? > CORE::exit(0); and you don't need this either, especiall if you

Re: exec and detach a subprocess

2005-02-19 Thread Stas Bekman
Igor Shevchenko wrote: On Saturday 19 February 2005 03:06, Stas Bekman wrote: What about? $r->spawn_proc_prog http://perl.apache.org/docs/2.0/api/Apache/SubProcess.html#C_spawn_proc_pro g_ Thanks for those links, Stas! I had to find them by myself as they are in docs... The following worked for

Re: exec and detach a subprocess

2005-02-19 Thread Igor Shevchenko
On Saturday 19 February 2005 03:06, Stas Bekman wrote: > What about? > $r->spawn_proc_prog > http://perl.apache.org/docs/2.0/api/Apache/SubProcess.html#C_spawn_proc_pro >g_ Thanks for those links, Stas! I had to find them by myself as they are in docs... The following worked for me: A helper su

Re: exec and detach a subprocess

2005-02-18 Thread Stas Bekman
Igor Shevchenko wrote: Hi all, How can I launch a subprocess and have it completely detached from the mod_perl2/apache2 environment ? All file descriptors closed, not in a process group, etc. I was trying to do it like this: sub safe_exec { return if fork() > 0; # close all descript

exec and detach a subprocess

2005-02-18 Thread Igor Shevchenko
Hi all, How can I launch a subprocess and have it completely detached from the mod_perl2/apache2 environment ? All file descriptors closed, not in a process group, etc. I was trying to do it like this: sub safe_exec { return if fork() > 0; # close all descriptors foreach my $f