I'm using OpenOffice as a daemon. Sometimes, when the daemon is running a long time, CPU use spikes very high and then OpenOffice crashes. At this point, OpenOffice doesn't work and document generation fails.
How can I restart automatically OpenOffice daemon when this problem happens? Is there any way to monitor the service or to program a watchdog to handle it?