[mythtv-users] How do I create a mythbackend watchdog timer?

Ian Barton lists at manor-farm.org
Tue Aug 18 21:02:21 UTC 2009


> In another thread, it was pointed out that mythbackend crashes
> periodically and there is nothing I can do about it until it is
> debugged.  So, I want to create a timer that will restart if if it has
> crashed becasue I don't want my marriage to crash along with
> mythbackend.
> 
> There seem to be a ton of opinions on how to do this along with lots
> of notes to change this or that line if it causes problems.  Someone
> must be doing this and have an opinion on what works.  The email
> feature would be great if that works out of the box but in any event
> some monitoring that something happened.
> 
> I found this, which has several options
> http://www.mythtv.org/wiki/StatusMonitoringHowTo
> 
monit works fine here. Email works out of the box for me, but I do have 
Postfix installed on my back end. Below is the relevant portion of my 
/etc/monit/monitrc, which is pretty much what is in the wiki.

Ian.

--------------------------------------------------------------
set daemon  30
set logfile /var/log/monit.log
set mailserver mythtv.banter.local
set mail-format
  { from: monit at mythtv.banter.local }
set alert ian at firewall.banter.local  # Send alert to system admin on any 
event
set httpd port 2812 and
     #allow ash.mydomain.com
     #allow 10.0.0.90
     allow 192.168.0.0/255.255.255.0
     allow 127.0.0.1
     allow haze.mydomain.com
     allow admin:monit     # user 'admin' with password 'monit'


check process mythbackend with pidfile /var/run/mythtv/mythbackend.pid
  group mythtv
  start program = "/etc/init.d/mythtv-backend restart"
  stop program  = "/etc/init.d/mythtv-backend stop"
if failed port 6544 proto http then exec "/usr/bin/python 
/home/ian/devel/python_twitter_notify/twitter_notify.py"
  mode active
  depends on mysql
if failed port 6544 proto http then restart
  mode active
  depends on mysql

check process mysql with pidfile /var/run/mysqld/mysqld.pid
  group mythtv
  start program = "/etc/init.d/mysql start"
  stop program = "/etc/init.d/mysql stop"
  if failed port 3306 then restart
  mode active


More information about the mythtv-users mailing list