in reply to Reasonably accurate timing

Why don't you just set it up as a cron job? Right now, 99.16% of time it's just tying up resources. This also reduces the chance of the script being blown away by accident. Next minute, it'll be back again...

--
g r i n d e r

Replies are listed 'Best First'.
Re: Re: Reasonably accurate timing
by traveler (Parson) on Jul 23, 2001 at 22:44 UTC
    Normally that would be a good solution. Unfortunately, this script does the following:
    1. Read in a (possibly) very large file and process it.
    2. Process and plot data every minute.
    The data from phase 1 is needed in phase 2. I actually plan on running the script from init...
      I recommend mixing solutions.

      Run the script from a cron.

      However have the script first try to grab a lock, if it can then it is the only copy running so proceed. If it cannot then exit immediately. Basically the same idea as Highlander - allow only one invocation at a time of an expensive CGI script however exiting is to be expected.

      I believe that you will find this approach significantly better for dealing with sporadic problems (lost network connections, unexpectedly high load killing a script, needing to move the script and not losing fact of the detail that it is still in init, etc). It does not solve the problem at hand though.