[mythtv-users] Remotely restarting mythfrontend

Matthias Thyroff lists at thyroff.net
Mon Feb 12 11:28:34 UTC 2007


Am Montag, den 12.02.2007, 22:09 +1100 schrieb Sammo:
> Is it possible to ssh into a mythtv box and restart mythfrontend?
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

I autostart the frontend with X; I can remotely restart X
(/etc/init.d/kdm restart), this does it. 

But I can also start and stop the frontend with the remote. I am using a
trick I found here on the list, not my invention. Anyway before tracing
that back down, I will describe what I do: 

I start "irexec -d" (right now autostart with the X autologin, but that
is not good because I end up with several instances of it when I restart
X; it should work to autostart it with rc.local but I have not tried). 

In my lircrc I have

# TV Button
begin
prog = irexec
button = TV
config = /usr/local/bin/mythtvbutton.sh
end

and mythtvbutton.sh does

#!/bin/bash
PROG=mythfrontend
STATUS=`ps -e | grep $PROG | grep -v grep | wc -l | awk '{print $1}'`

if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
    if [ $STATUS -eq 0 ]
    then
        echo 0 >> /tmp/mythtvbuttontest.txt
        ( $PROG & )
    else
        echo 1 >> /tmp/mythtvbuttontest.txt
        killall $PROG
    fi
fi
exit 0

******

i.e. it stops the frontend when it finds it running or it starts it if
not. 

I hope you like that!

Cheers

	Matthias




More information about the mythtv-users mailing list