Restart mythbackend when it crashes
Mythbackend crashes from time to time, it would be nice if it would autorestart.
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- High
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- Dave Walker
- Definition:
- Approved
- Series goal:
- Accepted for 9.04
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- Thomas Mashos
- Completed by
- Thomas Mashos
Related branches
Related bugs
Sprints
Whiteboard
On my gentoo system I've used monit for this:
prospero ~ # cat /etc/monit.
check process mythbackend with pidfile /var/run/
start program = "/etc/init.
stop program = "/etc/init.
if failed host prospero.
if 5 restarts within 5 cycles then timeout
Much more flexible than cron if you ask me - have run into situations where myth fails ungracefully (such as failing to listen on 6544 for some reason). Would a mythbuntu-monit package dumping a file in /etc/monit.d/ fit the bill? Debconf script might be needed to make defualt monit install a bit more friendly.
On myPVR we use a script based on http://
This gets run out of cron every minute
* * * * * root /usr/local/
Plus we have a logrotate script to manage and clean up the generated log files.
ALTERNATE
I currently use a simple bash script that is run as a daemon and catches mythbackend failing within a second. It then restarts mythbackend. Furthermore, it check mythfrontend (using telnet) where it is, if it is in LiveTV mode, resets it to LiveTV, so it re-connects to the backend and begins playing livetv again. This process takes about ten seconds, but I also have a small C application (that uses libxosd) that displays "Please Wait: \n Restarting mythbackend" on the screen. It works pretty well - and could be expanded to support multiple front-ends.
I'm not sure why this has no priority: mythbackend dies a lot, it would be nice for something to be in place to catch it by default.
Another possibility is to use upstart to keep it running
upstart-script that has been working for me for about a year:
# mythbackend
#
# This service maintains a mythbackend from the point the mysql-server is
# started until it is shut down again.
start on mysql-start
stop on mysql-stop
respawn
pre-start script
mkdir -p /var/run/mythtv
chown -R mythtv /var/run/mythtv
end script
exec su mythtv -c "exec mythbackend --logfile /var/log/