Just to close this. I installed the code below. I killed mythbackend and it came back 1 minuite later with the appropriate message in the logs. I hope to never see a system without mythbackend running.<div><br></div><div>
I did not want to fool with monti as this does what I want but thanks to everyone who helped with suggestions.</div><div><br></div><div>Allen</div><div>---------------------------------------------------------------------</div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">I created a file /etc/cron.d/mythmon to run my script every minute and restart mythbackend if it has crashed<br>
<br>* * * * * root /usr/bin/mythmon<br><br>The following script was put in /usr/bin with "sudo chmod 755 /usr/bin/mythmon"<br><br>#!/bin/bash<br>LOG=/var/log/mythtv/mythbackend.log<br><br># commented out the following line after initial checking to see that the code was running</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "># date "+%Y-%m-%d %H:%M:%S Checking" >> /tmp/mythmon.log<br><br>if ! ps -ef | grep [m]ythbackend >/dev/null; then<br>
<br> # Check whether setup utility is running<br> if ps -ef | grep [m]ythtv-setup >/dev/null; then<br> date "+%Y-%m-%d %H:%M:%S mythtv-setup running" >> /tmp/mythmon.log<br> exit 0<br> fi<br><br> # Mythbackend has crashed, log and restart<br>
date "+%Y-%m-%d %H:%M:%S Crash detected - restarting mythbackend" >> $LOG<br> date "+%Y-%m-%d %H:%M:%S Crash detected - restarting mythbackend" >><br>/tmp/mythmon.log<br> chown mythtv:mythtv $LOG<br>
/etc/init.d/mythtv-backend restart<br>fi</span></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Testing: Initally, every minute the script would write out a message to /tmp/mythmon.log. After a few of these, I commented out that one line as shown in the script above. No use filling the log file up. Then I issued this command</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="font-size: 13px; ">ps -ef | grep [m]ythbackend</span></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">and sudo kill <process number from above></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Then <span class="Apple-style-span" style="font-size: 13px; ">ps -ef | grep [m]ythbackend and mythbackend was gone but came back after a short time.</span></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">When the script restarts mythbackend, it puts a message in the mythbackend.log file. Nice touch.</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">If anyone knows of a problem with this, please let me know.</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Allen</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div>