<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br><br><div>> Date: Wed, 21 Jan 2015 09:25:25 +1100<br>> From: michael@thewatsonfamily.id.au<br>> To: mythtv-users@mythtv.org<br>> Subject: Re: [mythtv-users] Sleep mythfrontend from remote<br>> <br>> On 21/01/2015 3:42 AM, Josu Lazkano wrote:<br>> > Hello list,<br>> ><br>> > I have a frontend in the bedroom and I want to configure to shutdown<br>> > in a certain time (30/60/90 minutes). Maybe a bash script executed<br>> > with a remote key.<br>> ><br>> > Anyone got it?<br>> ><br>> > Regards.<br>> ><br>> I have a script that monitors xscreensaver, waits until the screen has <br>> been blanked (screensaver active) for 5 minutes (15 minutes if frontend <br>> is playing a recording/video - xscreensaver will only activate when <br>> recording/video playback is paused).  When screensaver is active for <br>> defined time, then it shuts down the system, if playback was paused, it <br>> sets a bookmark before shutting down.<br>> <br>> </div><div><br></div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">Have I got such a script?  Almost.<o:p></o:p></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""><br></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">I run a combined FE/BE using
mythwelcome.  The power off button on the
remote triggers a script to force the FE back to welcome screen which then
closes down the system.<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">It needs xdotool installed
and the keybinding to allow escape key to quit the frontend.  Would adding an extra ‘sleep’ at the start do
it for you?<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">HTH<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">Phil<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">  <o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""># /usr/bin/remotepower.sh<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""># Initiates a shutdown when
the remote power putton is pressed.<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""># Send escapes to Mythtv
frontend until it closes back to welcome<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""># Finally unlock shutdown in
case I forgot<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#echo "$(date +%F"
"%T) $0 started">>/home/phil/my.log<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family: 'Courier New'; font-size: 11pt;">REPLY=0</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">while [ $REPLY -eq 0 ]; do<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">     wmctrl -a 'MythTV Frontend'<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">     REPLY=$?<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">     if [ $REPLY -eq 0 ]; then<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">           xdotool key "Escape"<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">           #  echo "xdotool reply $?">>
/home/phil/my.log<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">           sleep 1<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">     fi<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">done<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family: 'Courier New'; font-size: 11pt;">mythshutdown --unlock</span></p>

<p class="MsoNormal"><span style="font-family: 'Courier New'; font-size: 11pt;">exit</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> </span></p>

<p class="MsoNormal"><o:p> </o:p></p></div>                                          </div></body>
</html>