in reply to Re: Reasonably accurate timing
in thread Reasonably accurate timing

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...

Replies are listed 'Best First'.
Re (tilly) 3: Reasonably accurate timing
by tilly (Archbishop) on Jul 24, 2001 at 08:51 UTC
    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.