Hi!
I'm having a problem with system/exec, i'm hoping ya can lend me a hand...
I've got two perl scripts. Script one is browser based, takes formdata input and stores it into a local file on the server. Then it needs to execute the second script (which processes the file), display a message to the user and end the browser session (while the 2nd script is still going). The second script takes quite a while, and involves a lot of database operations, so I don't want the browser to have to wait for it to finish ( it might time-out and kill the script! XD )
From reading the man pages, I expect exec to create a new fork, start running the second script, and let the first one continue. However, exec hangs up the web browser on script execution even worse than system does!
Is my usage wrong, or does this forking not work properly in an apache/web browsing environment?
Here's the syntax I've used...
exec "/home/myuser/www/cgi-bin/foo/bar/import.pl $fn";
system "/home/myuser/www/cgi-bin/foo/bar/import.pl $fn";
exec "/home/myuser/www/cgi-bin/foo/bar/import.pl", $fn;
system "/home/myuser/www/cgi-bin/foo/bar/import.pl", $fn;
Is there another way to have the browser-run perl script execute the second script, in the background, and continue without hanging?
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.