Hey Folks,
I'm greatly hoping someone can indicate what precisely I am doing wrong with the following code. I believe the problem lies in the manner in which my fork() and exec() are interacting. The code is as follows:
sub do_work {
my($query) = @_;
return if( $query->param('password') ne 'pass' );
if($query->param('which_bot') eq 'chump') {
if($pid = fork()) {
return;
} elsif(defined $pid) {
my @args = ("/bin/killall", "-TERM", "python")
+;
#system(@args);
exec('/usr/bin/python /usr/share/chump-1.3/src
+/dailychumpbot.py -i -s "neutron.oftc.net" -n chumpy --channel="#iitl
+ug" -d /httpd/htdocs/www/chump -e /chump/churn_html.xsl');
exit;
}
}
}
The child process does indeed execute the exec, and a python process begins. Within a second, or so (the script ends shortly after this do_work() function), the python execution ends ... this should not be as it is executing a bot that should be persistent.
Let me give everyone a preemptive thanks for your assitance with this!
Cheers,
Lacertus
------------------------------------
"There is more in heaven and earth
than is dreamt of in your philosophy"
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.