[mythtv-users] Script to restart backend after crash?
David Whyte
david.whyte at gmail.com
Sun Jan 20 06:08:48 UTC 2008
On Jan 19, 2008 1:25 AM, Piers Kittel <mailing at biased.org> wrote:
>
> So I need some sort of script to monitor the backend and restart it
> automatically when it stops working for some reason. Does anyone have
> some? The package I use is from debian-multimedia.org, currently
> version 0.20.2-0.2. It does come with its own startup script but
> doesn't work for some reason:
>
My script is attached. It runs every minute from cron. I think I
copied it off the mythTV wiki or something.
#!/bin/bash
pidno=$( ps ax | grep /usr/bin/mythbackend | grep -v grep | grep -v
mythbackend_monitor)
# Checks for pid in "ps" listing, field #1.
# Then makes sure it is the actual process, not the process invoked by
this script.
# The last "grep $1" filters out this possibility.
if [ -z "$pidno" ] # If, after all the filtering, the result is a
zero-length string,
then # no running process corresponds to the pid given.
echo "No such process running."
mail david at thewhytehouse.org -s "MythTV Restart" <
/var/log/mythtv/mythbackend.log
/etc/init.d/mythtv-backend restart
fi
Cheers,
Whytey
More information about the mythtv-users
mailing list