[mythtv-users] Script to restart backend after crash?

Piers Kittel mailing at biased.org
Sun Jan 20 11:31:13 UTC 2008


All excellent suggestions, shame none of those works due to my  
original problem.  So looks like I'll have to fix that first :/

Thanks to all for your time though!

Regards - Piers

On 20 Jan 2008, at 06:08, David Whyte wrote:

> 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
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users



More information about the mythtv-users mailing list