<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
I handle my Myth process precisely as you describe, Dan.  Although I am not
using CVS, I do get my share of segfaults.  I just respawn a script out of
inittab (I run Myth in a custom runlevel 4)  that restarts all my myth services
if Myth fails.  I actually restart the whole GUI when myth dies (or I kill
it) but it could easily be modified to only loop around myth.  My only problem
now is when myth freezes up, rather than crashing.  I will most likely have
to implement a kill switch anyway :(  Here are my scripts:<br>
<br>
In /etc/inittab (this technically does not need to be a respawn, but I did
it anyway just for kicks):<br>
...<br>
# MythTV respawns in runlevel 4<br>
xm:4:respawn:/usr/local/bin/mythinit<br>
...<br>
<br>
/usr/local/bin/mythinit:<br>
<br>
#!/bin/bash<br>
export DISPLAY=localhost:0<br>
SPAWNLIMIT=10<br>
# We'll hang up in here, just for runlevel 4<br>
x=0<br>
while [ true ]; do<br>
        #Start X<br>
        /usr/X11R6/bin/X > /var/log/xout.log 2>&1 &<br>
        echo "X starting:PID $!"<br>
        sleep 5<br>
        /usr/X11R6/bin/blackbox &<br>
        echo "Blackbox starting:PID $!"<br>
        # Don't let screen blank<br>
        /usr/X11R6/bin/xset -dpms s off<br>
        ## Start Myth<br>
        echo "Starting Myth"<br>
        /usr/local/bin/mythfrontend >> /var/log/myth.log 2>&1
&<br>
        MYTHPID=$!<br>
        echo "MythTV started, PID $MYTHPID"<br>
        echo "Starting Irxevent"<br>
        /etc/init.d/irx start<br>
        wait $MYTHPID<br>
        echo "MYTH DIED, RESTARTING ALL SERVICES"<br>
        /etc/init.d/irx stop<br>
        pkill blackbox<br>
        pkill X<br>
        # Wait for processes to exit before restarting<br>
        sleep 4<br>
        # Count the number of times we have done this, sleep if we respawn
too much<br>
        x=$(( $x + 1 ))<br>
        if [ $x -gt $SPAWNLIMIT ]; then<br>
                echo "ERROR: Myth respawing too much, disabling for 10 minutes"<br>
                sleep 600<br>
                x=0<br>
        fi<br>
done<br>
<br>
<br>
You could just run /usr/local/bin/mythfrontend out of inittab and it will
reliably stay up (barring freezes).<br>
<br>
<br>
Dan Conti wrote:<br>
<blockquote type="cite"
 cite="mid20030422212840.K23763@lister.acm.wwu.edu">
  <pre wrap="">Why not have a script that runs mythfrontend in the foreground in a loop,
and whenever the process exits it checks the error code. Intentional exits
should give back 0, and crashes should give back nonzero, so the script
could automagically start mythfrontend again on nonzero results. Then
start the script in the background.

I guess another factor is that if you are using CVS and getting segfaults
it would be of more use to actually track these in hopes of debugging
them, rather than work around them as best as possible..

On Wed, 23 Apr 2003, ben wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Just thought I'd share a little idea I had.  Since Mythfrontend still
has a seg fault every now and then, and since my wife doesn't understand
how to restart Mythfront end.  I mapped one of my remote keys to a
script that restarts mythfrontend.  The basic gist is this.  I'm using
Xdialog (<a class="moz-txt-link-freetext" href="http://www.chez.com/godefroy/">http://www.chez.com/godefroy/</a>) to display a window that you can
select to restart or not, thus avoiding accidental restarts. If you
don't want to do this you can just ignore remove everything but the
killall and and mythfrontend commands.

Script looks like this:

#!/bin/sh

Xdialog --title "Restart Mythtv" --yesno "Would you like to restart
MythTV?" 0 0

if [ $? -eq 0 ]
then
    sudo killall mythfrontend
    mythfrontend &
fi

Save this and store it somewher in you path.  I used /bin

Next add this to your lircrc:

begin
    prog = irexec
    button = tivo #Whatever Button you want to use
    config = RestartMyth.sh
End

Finally, add irexec to whatever script you are using to start irxevent.

Now you have a restart key.  Makes the Spousal Approval Level much
higher.

_______________________________________________
mythtv-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mythtv-users@snowman.net">mythtv-users@snowman.net</a>
<a class="moz-txt-link-freetext" href="http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-users">http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-users</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->_______________________________________________
mythtv-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mythtv-users@snowman.net">mythtv-users@snowman.net</a>
<a class="moz-txt-link-freetext" href="http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-users">http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-users</a>
  </pre>
</blockquote>
<br>
<br>
</body>
</html>