[mythtv-users] Restarting mythfrontend with the remote

Kevin Kuphal kuphal at dls.net
Fri Jan 21 13:53:09 EST 2005


Larry Silverman wrote:

>Thought I'd repost an answer to a question I gave to someone on the
>mythtvtalk.com forums at
>http://www.mythtvtalk.com/forum/viewtopic.php?t=542.  It might be of
>general interest to this group.
>
>The question was regarding restarting the mythfrontend with a remote keypress.
>
>Here's how I did it. I wrote a little perl script that runs in the
>background and uses the Lirc::Client library to trap my remote
>control's Power button. This causes mythfrontend to be killed and
>restarted on DISPLAY :0. I'm sure it's not the most elegant solution,
>but it works for my purposes.
>
>  
>
<snip> 

As a data point, here is my shell script:

MYTHEXISTS=`/bin/ps -e | grep mythfrontend | grep -v grep | awk '{print 
$1}'`;

if [ "$MYTHEXISTS" != "" ]; then
        for MYTHPROCESS in `/bin/ps -e | grep mythfrontend | grep -v 
grep | awk '{print $1}'`
        do
                echo $MYTHPROCESS;
                kill -9 $MYTHPROCESS;
        done
fi

/usr/bin/mythfrontend &

I bound it to lirc using:

begin
        prog = irexec
        remote = tivo
        button = CLEAR
        repeat = 0
        config = ~/frontend-restart.sh
end

and irexec is running as mythtv so it can kill the process and the 
frontend restarts in whatever X display you are running on.

A little simplier than Perl

Kevin


More information about the mythtv-users mailing list