[mythtv-users] mythbackend pid

Wade Maxfield mythtv at hotblack.co.nz
Sun Jul 1 23:31:39 UTC 2007


>I tried monit 
>(http://www.gossamer-threads.com/lists/mythtv/users/266596?search_string=monit;#266596)
>  but it depends on the PID... so we've come full circle.
>
>AJM,

OK, Now you seem to have totally lost me.  Aren't you concerned about 
keeping mythbackend going?

Reading this current thread it appears that you have your machine set 
to create the pid file on startup, and when it dies the pid file gets 
orphaned.  That's perfect for monit.  It can see that the pid file 
doesn't relate to a current process and tries to restart it for you.

But also from reading the monit docs, it does not require a pid file 
in order to keep an app going.  Checking the pid file against the 
current list of processes is just one way it can monitor.  I've got 
mine set up to use the pid file, as well as check via TCP .  So if 
mythbackend doesn't respond in a timely matter, monit can restart it 
for you.  That's the "if failed port 6544 proto http then restart" 
bit from my monitrc file.  It's checking the backend status via the 
http status port.

excerpt from my /etc/monitrc:
check process mythbackend with pidfile /var/run/mythbackend.pid
	group mythtv
	start program = "/sbin/service mythbackend start"
	stop program  = "/sbin/service mythbackend stop"
	if failed port 6544 proto http then restart
	mode manual
	depends on mysql


Or totally out in left field, I found this via a quick google seach. 
Just a quick script to restart the backend if it fails.
http://www.knoppmythwiki.org/index.php?page=MythBackendMonitorHowTo

  - Wade


More information about the mythtv-users mailing list