[mythtv-users] mythbackend pid
Matthew McClement
mythtv at macker.co.uk
Sun Jul 1 20:37:24 UTC 2007
A JM wrote:
*snip*
> Are there any other suggestions for a similar setup?
Well, the most simplistic, non-elegant way is to create a simple script
that runs from cron every minute and checks to see if myth is running, e.g.:
---
#!/bin/sh
PROCESS=`ps aux | grep \/usr\/bin\/mythbackend | grep -v grep`
if [ "$PROCESS" = "" ]; then
/etc/init.d/mythbackend restart
DATE=`date`
echo "$DATE restarted mythbackend" >> /var/log/backend-restart.log
fi
---
Name the script appropriately(and change the ..usr.. bit to match the
path to your copy of mythbackend) and then add a cron entry with "* * *
* *" and the path to the script. The log line isn't needed but it does
allow you to keep track of how often it decides to restart itself. The
only problem with this approach is that the restart granularity is 1
minute, so you could potentially lose up to 60 seconds of a recording.
Matt
More information about the mythtv-users
mailing list