[mythtv-users] Long time Mythwelcome bugs?

Thomas Boehm mythtv-users at lists.boehmi.net
Tue Aug 16 19:54:03 UTC 2011

Douglas Mackay wrote:
> On 15 August 2011 21:29, Thomas Boehm <mythtv-users at lists.boehmi.net> wrote:
>> My system is configured correctly following the wiki. It shuts down when
>> idle and wakes up when a recording is due.
>> You mention mythshutdown, could this be the cause of the problem? I'm
>> using the default server halt command "sudo shutdown -h now" and this is
>> written in the wiki too.
>> Wait a minute, now I see that there is something differently written in
>> the mythwelcome section of that article.
>> Command to set Wakeup Time             : mythshutdown --setwakeup $time
>> Server halt command                    : mythshutdown --shutdown
>> Pre Shutdown check-command             : mythshutdown --check
>> I'll try this tomorrow. The BE is busy recording right now...
> For the automatic frontend starting to work you need to be using
> mythshutdown (which is really the helper app for mythwelcome). In the
> ACPI wakeup wiki (Mythwelcome users in section 5.2) there's the
> following description of what happens if everything is set-up as
> detailed in the Wiki :-
> The backend 'Pre Shutdown check-command' will be called - if it returns 0 then
> The backend 'Command to set Wakeup Time' (mythshutdown --setwakeup
> $time) will be called. This writes the time into the database which
> mythwelcome will then use to detect if the next start-up is manual or
> for a scheduled recording / daily wakeup period.
> The backend 'Server halt command' (mythshutdown --shutdown) will be
> called. This runs the mythwelcome 'Command to set wakeup time' (sudo
> sh -c "/usr/bin/setwakeup.sh $time"). The $time variable here will
> either be the time of the next scheduled recording or the time of the
> next defined wakeup period. The mythwelcome 'Command to shutdown' will
> then be called (sudo shutdown -h now) to shutdown the system.

<rant> OMG, this is so painful and buggy!</rant>

I followed the wiki word by word, but mythwelcome seems to have it's own

Firstly, why is the setwakeup.sh different for the different cases?
Whether the BIOS time is UTC or not should be the same no matter whether
I use mythwelcome or not?

Secondly, why is the command to set wakeup time in mythwelcome 'sudo sh
-c "/usr/bin/setwakeup.sh $time"' and not just 'sudo
/usr/bin/setwakeup.sh $time'? The first command would allow the mythtv
user to open a *root terminal* at any time without a password if you
make the changes in the sudoers file!!! Why not running everything as
root then?

For my tests I used an idle time of 60 seconds and scheduled a recording
starting soon, but more than the times of "idle shutdown timeout",
"maximum wait for recordings" (3 min) and "startup for recordings" (2
min) added together (BTW: why is one value in minutes and the other two
in seconds? It's not consistent) to not spend even more time debugging.
When mythwelcome counts down, then it stops at 10 seconds and stays like
this for about a minute and starts the countdown again at 60 seconds.

I wrote a little wrapper script to log the time, the executed command
and the exit code of that command and it appears that if the next
recording is less than ~20 minutes in the future, mythwelcome will not
execute any of the commands and reset the countdown. Only the three
commands set up in mythtv-setup will be executed. There seems to be a
hard coded time of about 20 minutes within mythwelcome which prevents it
from writing the wakeup time into the BIOS and shutting down. It took me
quite a while to figure that out. To me it looked like it never works or
there is a mistake in my configuration somewhere.

Also, if you switch on the PC manually within ~20 minutes of the next
recording, then mythwelcome will not start mythfrontend as it should. To
mythwelcome it will look as if the PC got woken up automatically. I
don't know whether it's possible to let mythwelcome know how the PC got
switched on in another way, I just wanted to mention it.

More information about the mythtv-users mailing list