I am writing a script that takes a data file and runs an application (spider.exe) to update a database. The problem I’m having is that I don’t know how to kill the application if it runs over a certain amount of time. I am able to start the application using the system command, and I can tell if the application finished processing because it generates an error file. I have also tried using proc::simple, but am having some interesting results. When starting the process, it always returns that the application has not started, yet it did start, and the poll function always returns the application is running even when it is not, and the kill method does not work at all. The server is running W2K, so the alarm function (as I understand from reading other threads) will not work either. I have also looked into IPC::Run, but am not sure if it will work (I could be wrong though) Does anyone have any suggestions on how to kill the application if it runs too long? Thanks
Things I’ve tried:
system ("start k:\\spider\\spider.exe”); # works - don’t know how to kill application
$spiderProc = Proc::Simple->new();
$spiderStatus = $spiderProc->start("k:\\spider\\spider.exe");
print ("spider start status: $ spiderStatus"); # returns start failed
$spiderPoll = $spiderProc->poll();
print ("test poll: $spiderPoll"); # returns running
$tempExitStat = $spiderProc->kill();
print ("killing: $tempExitStat"); # returns fill failed
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.