Mailing List Archive

No Auto-shutdown if started for wakeup period. Scheduler change required.
Hi all,

I've already submitted a patch to improve the autoshutdown behaviour.
The patch is here: http://svn.mythtv.org/trac/ticket/3403

I've encountered another problem, where the box will not shutdown if the
box was started for a daily wakeup period. The scheduler
(scheduler.cpp), has code that tries to detect if the machine was
started automatically (and hence should allow an auto shutdown). It's
around line 1354. It does this by seeing if a recording is about to
start. But this isn't good enough. It needs to also consider the
wakeup periods.

The mythshutdown program has code that determines if the startup was
automatic or manual. It takes scheduled recordings and the wakeup
periods into account. The test can be performed by running:
"mythshutdown --startup", which returns an exit status of 0 if
automatic, or 1 if manual startup. I think we should change the
scheduler to also use this technique (possibly in addition to the test
it already does).

Chris Pinkham, the scheduler is your area, what do you think? We could
call "mythshutdown --startup", or refactor that code to be called
directly from the scheduler?

I'd like to work up for a patch for this. Which way do you think is
best approach?

PS: It is possible to turn off "blockSDWUwithoutClient". This will
allow the backend to shutdown even if a client has never connected.
without having a client connected. But I've had a lot of problems with
this. It's way too trigger happy. If you restart the backend, and
the frontend it started but sitting on a menu .... the backend will
shutdown the box. I even had the backend shutdown my box in the
middle of an ubuntu upgrade because of that, which caused a lot of
pain. So I'd rather leave this setting on ... but have the backend
detect if it was started automatically correctly.

Thanks,
Matt
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: No Auto-shutdown if started for wakeup period. Scheduler change required. [ In reply to ]
* On Sat May 19, 2007 at 09:39:07PM +1000, Matt Doran wrote:
> Chris Pinkham, the scheduler is your area, what do you think? We could
> call "mythshutdown --startup", or refactor that code to be called
> directly from the scheduler?

Scheduler is David Engel's area actually. I think he'll say the same
thing here though so I'm probably safe in responding.... :)

I don't think we want to call 'mythshutdown --startup' from within the
scheduler, we'd rather move that common check code into libmythtv
somewhere and call the common code from the scheduler and mythshutdown.

> PS: It is possible to turn off "blockSDWUwithoutClient". This will

Have to defer to someone else on this one, I'm very unfamiliar with
the auto startup/shutdown code.

--
Chris
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: No Auto-shutdown if started for wakeup period. Scheduler change required. [ In reply to ]
Chris Pinkham wrote:
> * On Sat May 19, 2007 at 09:39:07PM +1000, Matt Doran wrote:
>
>> Chris Pinkham, the scheduler is your area, what do you think? We could
>> call "mythshutdown --startup", or refactor that code to be called
>> directly from the scheduler?
>>
>
> Scheduler is David Engel's area actually. I think he'll say the same
> thing here though so I'm probably safe in responding.... :)
>
> I don't think we want to call 'mythshutdown --startup' from within the
> scheduler, we'd rather move that common check code into libmythtv
> somewhere and call the common code from the scheduler and mythshutdown.
>
>
Hi Chris,

I've whipped up a patch. I didn't bother moving code into a common
library, because all it does it to check to see whether we're close to
the scheduled auto-startup time as saved in the DB. It's only a few
lines of code, and didn't seem worth it. It works well for me and is
low risk.

Patch change log:

Fix auto-start detection in scheduler to consider the mythwelcome's
wakeup periods. This allowing the machine to auto-shutdown after
being started for a wakeup period. It also means that the
startupCommand is called with "auto" parameter when started for a
wakeup period (and not just a recording).

Think this looks ok? Should I create an issue to track the patch?

--Matt
Re: No Auto-shutdown if started for wakeup period. Scheduler change required. [ In reply to ]
On Sat, May 19, 2007 at 12:26:41PM -0400, Chris Pinkham wrote:
> Scheduler is David Engel's area actually. I think he'll say the same
> thing here though so I'm probably safe in responding.... :)

As inactive as I've been, I wouldn't exactly call any area mine. :)

> I don't think we want to call 'mythshutdown --startup' from within the
> scheduler, we'd rather move that common check code into libmythtv
> somewhere and call the common code from the scheduler and mythshutdown.

Auto shutdown and startup is not something I try to mess with. I
don't use it so all I try to do is not break what is already there.
Consequently, if someone has a better way that everyone is happy with,
I'm OK with it too.

David
--
David Engel
david@istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev