[mythtv-users] /usr/local/bin/mythpowerbutton.sh

Nick knowledgejunkie at gmail.com
Sun Mar 19 01:05:31 UTC 2006


On 18/03/06, White Joe <joe.white at consultant.volvo.com> wrote:
> I have been running MythTV for a little over a year now, and its time to
> get
> that Power Button script from Jarod's guide working.   All of the other
> buttons work, and its feeling lonely.
>
> 1) I have the file ~/.mythtv/lircrc, which contains only one reference
> to
> POWER in the entire file.
> # Power Button
> begin
> prog = irexec
> button = POWER
> repeat = 4
> config = /usr/local/bin/mythpowerbutton.sh
> end

Looks fine

> 2) I run irw and push the power button and get:
>
> 000000000000114c 00 POWER rs15-2116-vcr0081

Button is recognised

> 3)  /usr/local/bin/mythpowerbutton.sh was created under the root user
> and
> given the appropriate permissions -- chmod +x
> /usr/local/bin/mythpowerbutton.sh
>
> #!/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
>         ( $PROG & )
>     else
>         killall $PROG
>     fi
> fi
> exit 0

Same as mine

> 4) myth-load.sh

snipped non-LIRC commands

>     # Launch irexec for myth power button stop/start
>     irexec &

I use the command:

/usr/local/bin/irexec -d /home/mythtv/.lircrc

which provides the name of the LIRC config to use and daemonises
irexec (ideal for running irexec from a startup script). Check to make
sure your ~/.lircrc (which is the default file used if you don't
specify one) contains the POWER config (or is symlinked to the MythTV
file).

Nick


More information about the mythtv-users mailing list