It's not clear how you will determine how many records have be processed by the external batch job from external to that batch job. Assuming you can do this (by checking the size of an output file or having the batch process log its progress to a file somewhere), then the next question is what action to you want to take if your calculated average rate is out of spec?

If the action you want to take can be completed by a third process that performs the check and calculation, then its an easier problem than if you need to pass that information back to the parent script that initiates the external batch job.

One possibility is that you could fork the parent script just before initiating the batch job and have the child watch the parent (or vice versa) and take the appropriate action.

If you are using a threaded perl (AS5.8) or similar, then you could use a thread for for the same purpose. This has the advantage of making communucation between the watcher and the script that starts the batch job easier--should that be a requirement.

You could also use Win32::Process to detach a process to run a second copy of perl and an independant script that uses sleep in a loop to perform the checking and takes the action if it falls out of the loop. Adding a check to make this self terminating after a specified amount of time is easy too.


Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.


In reply to Re: Periodic checks by BrowserUk
in thread Periodic checks by elbow

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.