[mythtv-users] Backend Crashes / Status Monitoring
wd at pobox.com
Tue Mar 22 19:40:20 UTC 2005
Dave Ansell wrote:
> 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.
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
# The last "grep $1" filters out this possibility.
if [ -z "$pidno" ] # If, after all the filtering, the result is a
then # no running process corresponds to the pid given.
echo "No such process running."
mail <mynumber>@mobile.att.net -s Uh-oh < /tmp/crap
More information about the mythtv-users