perlquestion
asdfgroup
Hi,
This is repost of [id://253126] with more comments and explaining (it looks like on prev post problems was not so clear for understanding as I thought ;( ).
So problem : <br>
I wonna to start some long-running code from web-interface. This can be done 2 ways : <br>
- spawn separate process with help of fork<br>
- use at or cron<br>
Fork looks like more lazy (and right!) way to do this thing.<br>
Unofrtunately my process works fine in command line, but stoped mystically in Apache (after about 10 mins of work) <br>
Code looks like :
<code>
redirect_to("Prev_page.html") if fork();
#child here
close STDIN; close STDERR; close STDOUT;
# we inherit this filehandles from Apache. If we don't close, Apache will wait for child
use POSIX 'setsid';
setsid;
#Change PGID. So Apache can't kill child (and won't know about it)
# Long-running code here
</code>
Similar running program on the same server works without any problem (about 20 mins of execution).<br>
Apache works under SuEXEC. No ulimits setted (checked both in CGI script and in shell for this user).<BR>
<br>
Can anybody imagine reason why this can happens ? <br>
Sincerely, Nikita Savin