[mythtv-users] How to debug wake up script

Paul Harrison mythtv at dsl.pipex.com
Sat Mar 29 11:43:53 UTC 2008


Greg wrote:
>  I am struggling with what should
be easy.

>

>  I am attempting to setup wakeup, I can manually set the

>  /proc/acpi/alarm just using a cat '2008.03.29 etc' >
/procacpi/alarm

>  and shutdown teh system. This will then start ok.

>

>  I have the script in my myth setup using "sudo

>  /usr/local/bin/my-wakeup.sh $time" and the mythtv user is set sudo


>  NOPASSWD for the script, but it does not appear to be run on
mythtv

>  shutdown.

>

>  In the script it also writes a time stamp to a plain text file and


>  that does not get written so I know it's not running.

>

>  The script can be run with sudo /usr/local/bin/my-wakeup.sh on the


>  command line and it works and writes to the acpi alarm and my text


>  file..

>

>  How can I debug to find out error messages? I cannot find anything
in

>  my /var/log/messages and am now stuck.

>

>  Thanks for any help on this.

>

>  -Greg

>

If you used the instructions on the wiki then you probably haven't got 
things set up quite right. I have just upgraded my parents setup to use 
acpi instead of nvram-wakeup after upgrading the kernel to one that now 
supports ACPI and noticed the wiki instructions where misleading, 
outdated and just plain wrong in a few places.

These are the settings I used, from memory so may be slightly wrong :-) 
but should point you in the right direction. I have things setup to use 
MythWelcome but there is no reason these settings wont work if you don't 
use MythWelcome.

You should run mythtv-setup and on the Shutdown/Wakeup Options page set 
the following settings:

        
        Block shutdown before
        client connected:                       should be unchecked
        Idletimeout (secs):                    any value greater that 0
        Wakeup time format:                yyyy-MM-ddThh:mm
        Set wakeup time command:       mythshutdown --setwakeup $time
        Server Halt command:               mythshutdown --shutdown
        Pre shutdown check command:   mythshutdown --check


Now run mythwelcome --setup and set the following settings:

        command to set wakeup time      sudo sh -c 'echo $time > 
/proc/acpi/alarm'                           
                                                         you could call 
a script here like this:-
                                                         
set_acpi_wakeup.sh $time
                                    
        wakeup time format                   yyyy-MM-dd hh:mm:ss
                                                        this is the 
format of the time passed to the above command
 
        nvram-wakeup restart              <blank>
        command                                 nvram-wakeup required a 
reboot before the time would stick but
                                                       ACPI doesn't seem 
to require it so I left this blank.
                           
       Poweroff Command                  shutdown -h now
    
       Reboot Command                      /sbin/reboot

Some of these commands may require root privileges to work so depending 
on what user
mythbackend is run under you may need to play about with sudo to get 
things to work.

If you still have problems then try running each command as the user 
that the backend
uses to see where it's failing. This is roughly the sequence that the BE 
uses when it's
doing the shutting down.

1. abort if we have any clients still attached (usually any mythfrontends).

2. call the 'mythshutdown --check' and abort if it doesn't return 0.

3. if there are any upcoming recordings call 'mythshutdown --setwakeup 
$time' with the time of the next recording.

4. call mythshutdown --shutdown
    a)  mythshutdown now works out the time of the next wakeup which 
will either be
        the time of the next recording or the start time of the next 
wakeup period
        if any are set.
   
    b)  if there is no next wakeup time then just call 'shutdown -h now'.

    c)  call sudo sh -c 'echo $time > /proc/acpi/alarm' to set the next 
wakeup time in the rtc.

    d)  if we have a 'nvram-wakeup restart command' set run that then 
the reboot command
         if not set just call the power off command.

5. if we're still here then something went wrong so go back to 1 and try 
again.
 
 
Paul H.      





More information about the mythtv-users mailing list