[mythtv-users] Carbon Footprint

Daryl McDonald darylangela at gmail.com
Sun Sep 1 23:23:19 UTC 2013


On Sun, Sep 1, 2013 at 4:46 PM, Stefan Pappalardo <sjuk at gmx.de> wrote:

>  I try to answer your questions...
>
> Q: The wiki didn't cover it and your settings don't either, so I'm forced
> to assume that the "Startup Command" should be left
> blank?(Backend>General>Shutdown/Wakeup options page) My system will shut
> the backend down but will not wakeup for recordings, at this point. I can
> find no reference of what to put in the "Startup Command" box.
> A: You can safely leave it blank. For Details follow this link to the wiki
> http://www.mythtv.org/wiki/User_Manual:Detailed_configuration_Backend.
>
> Q: I did insert a disable hwclock script as directed by the wiki, how did
> you discern that it wasn't needed in your case?
> A: Try and error. Are you sure the disabling of the hwclock update does
> work correctly? When you Post your method, I can have a look at it. (Four
> eyes see more than two.)
>
> Q: Below is my setwakeup.sh, quite different than yours, is this due to
> the local verses UTC difference?
> A: I would recommend you to try my setwakeup.sh. But in your case you have
> to set "UTCBIOS" to false.
> I have found it in the "mythwelcome users" section of the ACPI_Wakeup Wiki
> entry http://www.mythtv.org/wiki/ACPI_Wakeup
>
> Q: I have what has been referred to as the "fussy BIOS" too.
> A: It's the same for me. It only woks if I disable "Power-On by Alarm" in
> the BIOS.
>
> Q: Block shutdown before client connected: unchecked >  checked, maybe I
> misinterpreted?
> A: Depends on your Setup. For Details follow this link to the wiki
> http://www.mythtv.org/wiki/User_Manual:Detailed_configuration_Backend.
>
> Q: Idle shutdown timeout (secs): 180 > currently at 0 to disable shutting
> down
> A: Depends on what you desire. I want my machine to shutdown after 180
> seconds if it is idle. Very comfortable in addition with mythwelcome.
> You only have to close the frontend. Shutdown will do automatically. Also
> good for testing. Give it a try.
>
> Q: Max. wait for recording (min): 15 > can't remember why I set to 120
> A: With this value the machine will not shutdown if your recording rules
> are busy everey two hours.
>
> Q: Command to set Wakeup Time:  sudo sh -c "/usr/bin/setwakeup.sh $time" >
> sudo /usr/bin/setwakeup.sh $time (wiki didn't cover sh -c or quotation
> marks)
> A: I had to do it because of mythwelcome (
> http://www.gossamer-threads.com/lists/mythtv/users/507639?search_string=Mythwelcome%20doesnt%20trigger%20setwakeup;#507639
> )
>
> Q: Then there is the next page "Backend Wakeup Settings"...
> A: These is for WakeOnLan and has nothing to do with "wake on alam".
>
> Hint: As a good starting point for configuration descriptions I would
> recommend you to have a look at the wiki (
> http://www.mythtv.org/wiki/User_Manual:Detailed_configuration_Backend)
>
> Good Luck ;-)
>
> Stefan Pappalardo
>
> Am 01.09.2013 20:28, schrieb Daryl McDonald:
>

Well I mirrored your settings and scripts and scheduled a recording for
7p.m. gave the system two minutes to shutdown the backend and set the alarm
then powered off, and waited until 7:05p.m. and it did not come on. Does
the last line of the following output indicate UTC time?:
 daryl at daryl-A780L3C:~$  sudo grep -i rtc /var/log/dmesg
[sudo] password for daryl:
[    0.199663] RTC time: 19:04:25, date: 09/01/13
[    1.222545] rtc_cmos 00:03: RTC can wake from S4
[    1.222673] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
[    1.222692] rtc0: alarms up to one month, y3k, 114 bytes nvram
[    1.229942] rtc_cmos 00:03: setting system clock to 2013-09-01 19:04:26
UTC (1378062266)

This is what my disable hwclock script looks like:
daryl at daryl-A780L3C:~$ cat /etc/init/hwclock-save.conf
# hwclock-save - save system clock to hardware clock
# hwclock-save - save system clock to hardware clock
#
# This task saves the time from the system clock back to the hardware
# clock on shutdown.

description "save system clock to hardware clock"

start on runlevel [06]

task

script
    . /etc/default/rcS
    [ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
    [ "$BADYEAR" = "yes" ] && badyear="--badyear"
    ACPITIME=`cat /proc/acpi/alarm`
    exec hwclock --rtc=/dev/rtc0 --systohc $tz --noadjfile $badyear
    echo "$ACPITIME" > /proc/acpi/alarm
end script
daryl at daryl-A780L3C:~$

and here is my setwakeup.sh:
daryl at daryl-A780L3C:~$ cat /usr/bin/setwakeup.sh
#!/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

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`
fi

echo 0 > /sys/class/rtc/rtc0/wakealarm       # clear alarm
echo $SECS > /sys/class/rtc/rtc0/wakealarm   # write the waketime

My two eyes are tired and confused, what do you see?

Thanks Daryl

>
>
>
> On Sun, Sep 1, 2013 at 11:51 AM, Stefan Pappalardo <sjuk at gmx.de> wrote:
>
>>  Hi Daryl, here you are.
>>
>> Operating System: Ubuntu 12.04.3 LTS
>> Motherboard: Gigabyte GA-MA785GM-US2H
>> BIOS RTC (real time clock) is set to UTC (not set to localtime)
>>
>> The machine is backend and frontend.
>> Mythshutdown is controlled by mythwelcome.
>>
>> Power Management Setup
>> ---------------------------------------
>> ACPI Suspend Type: S3 (STR)
>> HPET-Support: Disabled
>> Power-On by Alarm: Disabled
>> ErP Support: Disabled
>>
>> Hints
>> -------
>> 1: With HPET-Support and ErP Support enabled all seemed to work fine, but
>> the system never waked up.
>> 2: Setting a fixed Power-On by Alarm time can get into conflict with the
>> time mythtv sets. In my case it only works when I disable it in BIOS.
>> 3: I can only choose between S1 (Power on Suspend) and S3 (Suspend to
>> RAM) in BIOS. But I always use S5 (Soft Off).
>>
>> Kernel
>> ---------
>> sjuk at obelix:~$ uname -r
>> 3.2.0-52-generic
>>
>> sjuk at obelix:~$ sudo grep -i rtc /var/log/dmesg
>> [    0.157612] RTC time: 14:28:52, date: 09/01/13
>> [    1.592355] rtc_cmos 00:04: RTC can wake from S4
>> [    1.592440] rtc_cmos 00:04: rtc core: registered rtc_cmos as rtc0
>> [    1.592466] rtc0: alarms up to one month, 242 bytes nvram
>> [    1.598070] rtc_cmos 00:04: setting system clock to 2013-09-01
>> 14:28:54 UTC (1378045734)
>>
>> sjuk at obelix:~$ cat /proc/driver/rtc
>> rtc_time    : 14:50:45
>> rtc_date    : 2013-09-01
>> alrm_time    : 06:10:00
>> alrm_date    : 2013-09-02
>>
>> alarm_IRQ    : no
>> alrm_pending    : no
>> update IRQ enabled    : no
>> periodic IRQ enabled    : no
>> periodic IRQ frequency    : 1024
>> max user IRQ frequency    : 64
>> 24hr        : yes
>> periodic_IRQ    : no
>> update_IRQ    : no
>>  HPET_emulated    : no
>>
>> BCD        : yes
>> DST_enable    : no
>> periodic_freq    : 1024
>> batt_status    : okay
>>
>>  Disable hwclock updates
>> ---------------------------------
>> On my system there is no need to disable the hwclock updates
>>
>> Setwakeuptime (don't forget to make it executable)
>> -----------------------------------------------------------------
>> sjuk at obelix:~$ cat /usr/bin/setwakeup.sh
>> #!/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=true
>>
>> 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`
>> fi
>>
>> echo 0 > /sys/class/rtc/rtc0/wakealarm       # clear alarm
>> echo $SECS > /sys/class/rtc/rtc0/wakealarm   # write the waketime
>>
>> Sudo
>> -------
>> sjuk at obelix:~$ sudo cat /etc/sudoers.d/mythwelcome
>> Defaults:mythtv !requiretty
>> %mythtv ALL = NOPASSWD: /bin/sh, /usr/bin/setwakeup.sh, /sbin/shutdown,
>> /usr/bin/mythshutdown
>>
>> Backend (General > Shutdown/Wakeup Options)
>> --------------------------------------------------------------
>> Block shutdown before client connected: unchecked
>> Idle shutdown timeout (secs): 180
>> Max. wait for recording (min): 15
>> Startup before rec. (secs): 600
>> Wakeup time format: time_t
>> Command to set Wakeup Time:  sudo sh -c "/usr/bin/setwakeup.sh $time"
>> Server halt command: sudo shutdown -h now
>>
>>
>> When you have a question please post your settings corresponding to the
>> question.
>>
>> Good Luck ;-)
>>
>> Stefan
>>
>>  The wiki didn't cover it and your settings don't either, so I'm forced
> to assume that the "Startup Command" should be left
> blank?(Backend>General>Shutdown/Wakeup options page) My system will shut
> the backend down but will not wakeup for recordings, at this point. I can
> find no reference of what to put in the "Startup Command" box. Secondly I
> am using, to the best of my knowledge, Local time in the RTC, because I
> employ a dual boot, and as I compair terminal out put it seems to be off by
> a day:
>  daryl at daryl-A780L3C:~$ sudo grep -i rtc /var/log/dmesg
> [sudo] password for daryl:
> [    0.200520] RTC time: 14:43:57, date: 08/31/13
> [    1.242563] rtc_cmos 00:03: RTC can wake from S4
> [    1.242708] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
> [    1.242731] rtc0: alarms up to one month, y3k, 114 bytes nvram
> [    1.250110] rtc_cmos 00:03: setting system clock to 2013-08-31 14:43:58
> UTC (1377960238)
>
>  I got this reading Sunday Sept 1st just before 2p.m.
>
>  Although the time is correct from this probe:
>
>  daryl at daryl-A780L3C:~$ cat /proc/driver/rtc
> rtc_time : 13:32:16
> rtc_date : 2013-09-01
> alrm_time : 18:45:00
> alrm_date : 2013-08-31
> alarm_IRQ : no
> alrm_pending : no
> update IRQ enabled : no
>
>  Apparently one of my attempt to wakeup is still showing because it
> failed to execute.
> I did insert a disable hwclock script as directed by the wiki, how did you
> discern that it wasn't needed in your case?
>
>  Below is my setwakeup.sh, quite different than yours, is this due to the
> local verses UTC difference?:
>  daryl at daryl-A780L3C:~$ cat /usr/bin/setwakeup.sh
> #!/bin/sh
> #$1 is the first argument to the script. It is the time in seconds since
> 1970
> #this is defined in mythtv-setup with the time_t argument
>
>  echo 0 > /sys/class/rtc/rtc0/wakealarm      #this clears your alarm.
> echo $1 > /sys/class/rtc/rtc0/wakealarm     #this writes your alarm
> daryl at daryl-A780L3C:~$
>
>  I have what has been referred to as the "fussy BIOS" too, and thought I
> was getting somewhere, because after shutting down the system, before
> midnight, I would find it on the next morning. I had enabled wake from RTC
> and left the default setting "every day" and "00:00:00". Below is my kernel:
>  daryl at daryl-A780L3C:~$ uname -r
> 3.5.0-39-generic
>  My values appear after the > symbol
>  Block shutdown before client connected: unchecked >  checked, maybe I
> misinterpreted?
> Idle shutdown timeout (secs): 180 > currently at 0 to disable shutting down
> Max. wait for recording (min): 15 > can't remember why I set to 120
> Startup before rec. (secs): 600 > 600
> Wakeup time format: time_t  > time_t
> Command to set Wakeup Time:  sudo sh -c "/usr/bin/setwakeup.sh $time" >
> sudo /usr/bin/setwakeup.sh $time (wiki didn't cover sh -c or quotation
> marks)
> Server halt command: sudo shutdown -h now > sudo shutdown -p
>
>  Then there is the next page "Backend Wakeup Settings":
> Delay between wake attempts (secs)  default 0
> Wake attempts  default 5
> Wake Command   blank
> It continues with slave backend settings, which I don't have, but I need
> direction for the first three boxes.
>
>  Daryl
>
>
>
>
> _______________________________________________
> mythtv-users mailing listmythtv-users at mythtv.orghttp://www.mythtv.org/mailman/listinfo/mythtv-users
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20130901/3af67e7e/attachment.html>


More information about the mythtv-users mailing list