Dave Ansell wrote:
Hi,

I get occasional backend crashes - usually seems to be some qt/sql problem. Very difficult to eliminate entirely.

  Usually, the whole machine doesn't crash, just the backend and/or mysql.

Question is, would it be feasible to run a cron script to monitor the backend status, either on the same box or from some other linux box, then reboot the machine or restart services if a problem is detected.


I'm sure there are *much* more elegant ways of accomplishing this, but I run this simple cron script. I call it "mythmon.sh". If mythbackend isn't running, it'll email my cell phone. You could set it up to automatically restart the process or reboot the PC or whatever you want.


#!/bin/bash

pidno=$( ps ax | grep mythbackend | grep -v grep | grep -v mythmon)
# echo $pidno
# Checks for pid in "ps" listing, field #1.
# Then makes sure it is the actual process, not the process invoked by this script.
# The last "grep $1" filters out this possibility.
if [ -z "$pidno" ] # If, after all the filtering, the result is a zero-length string,
then # no running process corresponds to the pid given.
echo "No such process running."
mail <mynumber>@mobile.att.net -s Uh-oh < /tmp/crap
exit $E_NOSUCHPROCESS
fi
_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to