How do I set a cron job to A)check that a process is still running and B)if it isn't running to start/restart as it's a daemon?
Juz10mac
04-24-2005, 08:44 AM
I found information on cron here http://www.vmts.net/crontab.htm. I know a little about cron, but not enough to have it check a process. Maybe you could make a script that will do that, then have cron run the script. I hope this helps
Juz10mac
voldenuit
04-24-2005, 09:02 AM
There are tools like
http://cr.yp.to/daemontools.html
They work great for me on a Debian server I run in a colo (qmail, tinydns), but I never tried it on Mac OS X.
Depending on the daemon in question, it might not be good enough to just make sure it runs, it should still provide the service it's supposed to.
qmail is pretty much bulletproof, if it runs, it works.
Apache for example has modes of failure where it will still run, but stops to deliver pages.
A Nagios-like solution that checks for the service and takes action as you script it if the test fails, is probably the best if you really care for continued service.
hayne
04-24-2005, 12:23 PM
If you just want to do it the simple, brute force way, look at this old thread:
http://forums.macosxhints.com/showthread.php?t=24044
ibroughton
04-24-2005, 01:02 PM
Excellent, got it all sorted out now!Many thanks!
CPYCGerry
04-26-2005, 10:54 AM
I just ran into a gotcha. On older Macs running tcsh (e.g. 10.2.x) make sure you write:
ps axwww filename
It turns out that the terminal may not be wide enough.