[Zope] Using crontab instead of rc.d

Robert Miller rob@kalistra.com
Wed, 23 Aug 2000 15:06:05 -0700


On Wed, 23 Aug 2000, George Osvald wrote:

> My ISP where I have my web page, is running freeBSD 4.0. I do not know a lot
> about it. I know how to use crontab to start ZOPE at certain time how ever
> how do I use crontab to check on the script that is already running?
> Starting ZOPE again when it's running produces an error message and I do not
> know if that was a healthy solution.
> 
> to start it I would be using something like:
> 
> 5	*	*	*	*	root	./start
> 
<----SNIP further description---->
> 
> Is this setup at all possible?

The first thing I would do would be to handle all of this in a separate script,
and call that script from the crontab, rather than trying to integrate the
detection of the Zope process into the crontab file.  This way you could use
your favorite scripting language (I'd use python ;-]) to read the z2.pid file,
check for the existence of that process, check to see that the process is
indeed the Zope (python) process, and to relaunch Zope if need be.  There's
still the (probably) very minimal chance that your Zope could die, and then
another Zope process could be launched that ends up with the same PID, thus
fooling your detection script (depending on how it was coded), but I'm sure
even this is preventable, assuming the probability of my scenario occurring is
high enough to even warrant this effort.

So your crontab would end up like:

5   *   *   *   * 		root		./startzopeifdead.py

The 'startzopeifdead.py' (or whatever you end up naming it) will be the one to
execute the './start' command, if need be.

rob