[mythtv-users] Remotely restarting mythfrontend

Stroller linux.luser at myrealbox.com
Mon Feb 12 19:54:41 UTC 2007


On 12 Feb 2007, at 11:28, Matthias Thyroff wrote:
> Am Montag, den 12.02.2007, 22:09 +1100 schrieb Sammo:
>> Is it possible to ssh into a mythtv box and restart mythfrontend?
>
> 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. ...
>
> 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
>
> ******

If you'll excuse me for saying it, this seems like a rather  
convoluted way of doing things.

You already state that `/etc/init.d/kdm restart` works for you, so  
why do it any differently with lirc?

lirc's documentation <http://www.lirc.org/html/ 
configure.html#lircrc_format> suggests that it can pass parameters to  
programs, in this example "hello wold" is passed to `echo`:

     begin
         remote = ANIMAX
         button = MENU_DOWN
         prog   = irexec
         repeat = 0
         config = echo "Hello world!"
     end

So passing "start" to `/etc/init.d/kdm` should not be a problem, either:

     begin
         prog   = irexec
         button = TV
         repeat = 0
         config = /etc/init.d/kdm restart
     end

Your solution and antani's both check MythTV's PID, but my distro's  
init.d scripts already record the PID and make a note if it so that  
they can kill the process when I run them with the "stop" or  
"restart" parameter. I would rather leave PID management to them, as  
in my experience distro's init scripts tend to be quite long and  
comprehensive, handling case scenarios that I might have thought of  
when hacking together a quick bash script. If kill the process &  
start the program again manually it prevents them from doing their job.

Stroller.



More information about the mythtv-users mailing list