[mythtvnz] Hardware Recommendations

Jason Taylor killerkiwi2005 at gmail.com
Wed Oct 5 10:45:23 BST 2011


On 5 October 2011 18:10, David Moore <dmoo1790 at ihug.co.nz> wrote:

> On 05/10/11 17:35, Jason Taylor wrote:
> >     Some people like to leave their systems on 24/7 but I like to save
> the
> >     planet :) so I have mine set up to power down after I log off and
> power
> >     up again when myth needs to record something.
> >
> >
> > I've never manager to get this working as I'd like.. basically if its
> > after say 10pm and nothing is /being recorded or played/ I'd like the
> > machine to shutdown and then always wake up at say 8am (or earlier if
> > required for a recording).. this would save 10 hours of ontime a day and
> > keep the mrs happy about having to start the machine...
> >
> > I should really have another attempt at it... it would be quite a power
> > saving...
> >
> It wasn't too hard once I got my head around UTC vs NZ time zone stuff.
> I started with this web page:
>
> http://www.mythtv.org/wiki/ACPI_Wakeup
>
> Then I modified the setwakeup.sh script to suit my system and always
> wake at 6 pm (or earlier if needed to record) and power down at or after
> 10:30 pm if nobody is logged in. Here's the script I'm using now:
>
> ---------------------------------------------------------------
> #!/bin/sh
> #
> # set ACPI Wakeup time
> # usage: setwakeup.sh seconds
> #    seconds - number of seconds from epoch to UTC time (time_t time
> format)
> #
> # set UTCBIOS to true if bios is using UTC time
> # set UTCBIOS to false if bios is using local time
>
> UTCBIOS=false
>
> ONTIME=`date -u --date "\`date --date 'TZ="Pacific/Auckland" 6:00 pm
> today' +%F" "%T\`" +%s`
> ONNEXT=`date -u --date "\`date --date 'TZ="Pacific/Auckland" 6:00 pm
> tomorrow' +%F" "%T\`" +%s`
> OFFTIME=`date -u --date "\`date --date 'TZ="Pacific/Auckland" 10:30 pm
> today' +%F" "%T\`" +%s`
> NOW=`date -u --date "\`date +%F" "%T\`" +%s`
>
> echo $ONTIME
> echo $OFFTIME
> echo $ONNEXT
> echo $NOW
>
> if $UTCBIOS
> then
>     #utc bios - use supplied seconds
>     SECS=$1
> else
>     #non utc bios - convert supplied seconds to seconds from
>     #epoch to local time
>     SECS=`date -u --date "\`date --date @$1 +%F" "%T\`" +%s`
>
> echo $SECS
>
>     if [ $NOW -lt $ONTIME ]; then
>         if [ $SECS -gt $ONTIME ]; then
>             SECS=$ONTIME
>             echo "on time "$SECS
>         fi
>     else
>         if [ $SECS -gt $ONNEXT ]; then
>             SECS=$ONNEXT
>             echo "on next "$SECS
>         fi
>     fi
> fi
>
> echo 0 > /sys/class/rtc/rtc0/wakealarm         #this clears your alarm.
> echo $SECS > /sys/class/rtc/rtc0/wakealarm     #this writes your alarm
>
> cat /proc/driver/rtc #check if alarm set
> ---------------------------------------------------------------
>
> Here's my checklogin.sh script:
>
> ---------------------------------------------------------------
> #!/bin/bash
> # Check to see if anyone is currently logged in. Return zero if not and
> 1 if so.
> # Echoed text appears in log file. It can be removed and --quiet added
> to the
> # grep command once you are satisfied that mythTV is working properly
>
> ONTIME=`date --date "6:00 pm today" +%s`
> OFFTIME=`date --date "10:30 pm today" +%s`
> NOW=`date +%s`
>
> #DATE=`date +%F\ %T\.%N`
> #DATE=${DATE:0:23}
> if
>   # The leading space is important!
>   w | grep --quiet " 0 users"
>   then
> #    echo $DATE Noone is logged in, ok to shut down.
>     if [ $NOW -ge $OFFTIME -o $NOW -lt $ONTIME ]; then
>       exit 0
>     else
>       exit 1
>     fi
>   else
> #    echo $DATE Someone is still logged in, don\'t shut down!
>     exit 1
> fi
>

Thanks for that... the biggest issue I have is the system is never logged
out, but thats a great starting point

I know the wakeup works after playing with the rtc scripts its just getting
the shutdown and wakeups to do what i want

-- 
"Weekends don't count unless you spend them doing something completely
pointless. " - Calven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ourshack.com/pipermail/mythtvnz/attachments/20111005/ef0de522/attachment.htm 


More information about the mythtvnz mailing list