Hi,
This is repost of
Problem with for in CGI with more comments and explaining (it looks like on prev post problems was not so clear for understanding as I thought ;( ).
So problem :
I wonna to start some long-running code from web-interface. This can be done 2 ways :
- spawn separate process with help of fork
- use at or cron
Fork looks like more lazy (and right!) way to do this thing.
Unofrtunately my process works fine in command line, but stoped mystically in Apache (after about 10 mins of work)
Code looks like :
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 w
+ill 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
Similar running program on the same server works without any problem (about 20 mins of execution).
Apache works under SuEXEC. No ulimits setted (checked both in CGI script and in shell for this user).
Can anybody imagine reason why this can happens ?
Sincerely, Nikita Savin
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.