Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Mythwelcome always starts mythfrontend on boot.

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


chris at simmons

Sep 3, 2008, 11:29 AM

Post #1 of 10 (3512 views)
Permalink
Mythwelcome always starts mythfrontend on boot.

Hopefully someone can help me, I've had automatic shutdown/startup
mostly working for some time but I've never been able to persuade it to
not start the frontend on startup.

My system is a combined fontend/backend that automatically starts
mythwelcome on boot. What I'd ideally like to do is this:-

1) Mythwelcome starts frontend if user turns machine on
2) Mythwelcome doesn't start frontend if auto-starts for scheduled
recording - and hence will shut down when the recording finishes.
3) Auto-shutdowns when idle: sets the wakeup time for the next recording
using rtc and shuts the machine down.

So I've got 1) and 3) working but it *always* starts the frontend so 2)
never happens, meaning it tends to stay on all night if it wakes up to
record something, say. I got the impression that this isn't supposed to
happen as it renders the whole exercise somewhat pointless...

I've tried to follow the settings in the wiki
(http://www.mythtv.org/wiki/index.php/ACPI_Wakeup) towards the bottom
for rtc with no luck but maybe I spannered it up. I've tried other
settings too, its all quite confusing as there's seemingly two places
you can configure all this, one using mythtv-setup and another using
mythshutdown --setup and its as clear as mud what they do, which are
necessary etc.

Also I've set the 'Startup command' in mythtv-setup to dump the $status
to a file and it will contain "auto" some (all?) of the time. I
presumed this is what mythwelcome is using to decide whether to start
the frontend but who knows?

Thanks for your help!

Chris.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


myth at dermanouelian

Sep 3, 2008, 12:26 PM

Post #2 of 10 (3423 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

On Sep 3, 2008, at 11:29 AM, Chris Simmons wrote:

> Hopefully someone can help me, I've had automatic shutdown/startup
> mostly working for some time but I've never been able to persuade it
> to
> not start the frontend on startup.

There's an option in MythWelcome to not start the frontend when it
starts up.

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


James.Skimming at portraitsoftware

Sep 4, 2008, 10:34 AM

Post #3 of 10 (3410 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

Hi Chris

I've been using Mythwelcome for almost a year, I've not had your
problem, so I'm afraid I've never had to debug this particular issue.

I've noticed though, from the Mythwelcome log, the entry "mythshutdown
--startup returned: 0" when the machine starts automatically, (it's 1
when started manually).

If you're going to debug this, I'd suggest to start looking here first.

How much earlier than the begging of the recording are you waking up
your system? My system is configured to start recording 1 minute before
the scheduled time (some programs do start early) and to wake up 4
minutes before the recording.

The reason I've asked about your timings, is because I've noticed if I
manually restart about 10 minutes before a recording, mythwelcome
doesn't start the frontend, so I presume "mythshutdown --startup" uses
timings to demine how the system was started.

Hope this helps.

Jim.

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


James.Skimming at portraitsoftware

Sep 4, 2008, 10:42 AM

Post #4 of 10 (3405 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

> How much earlier than the begging of the recording are you
> waking up your system?

Not sure about begging, but you could try pleading? Doh!

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


chris at simmons

Sep 4, 2008, 12:41 PM

Post #5 of 10 (3403 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

James Skimming wrote:
> Hi Chris
>
> I've been using Mythwelcome for almost a year, I've not had your
> problem, so I'm afraid I've never had to debug this particular issue.
>
> I've noticed though, from the Mythwelcome log, the entry "mythshutdown
> --startup returned: 0" when the machine starts automatically, (it's 1
> when started manually).
>
> If you're going to debug this, I'd suggest to start looking here first.
>
That's interesting. I just turned my box on manually to test this and,
like I mentioned in my earlier post, I looked at the value of $status (I
dump this to a file on start up as you can see from my settings below).
It says 'user' so the backend clearly knows it was started by me rather
than due to an automatic wakeup. I also just ran "mythshutdown -p -v
all" and it says "looks like we were started manually1" amongst other
things.

However, I'm fairly sure I've seen these give contradictory answers on
an auto start but maybe I'm imagining it? I'll have to check it after
an auto start again to check this (when the wife isn't watching tv that
is :). I've checked the value the backend writes out several times and
that is always correct, I didn't know about mythshutdown -p til
recently, I assumed it would be using the same setting everywhere but
maybe not!
> How much earlier than the begging of the recording are you waking up
> your system? My system is configured to start recording 1 minute before
> the scheduled time (some programs do start early) and to wake up 4
> minutes before the recording.
>
>
I think it wakes up 2 minutes before plus there's 2 minutes before the
show starts. My other settings are below, maybe you can compare them
with yours to figure out the key difference?

mythtv-setup (Shutdown/Wakeup Options):-
Startup command: echo $status > /home/myth/restartStatus
Block shutdown before client connected: unchecked
Idle shutdown timeout (sec): 120
Mx. wait for recording (min): 10
Wakeup time format: time_t
Command to set Wakeup Time: /usr/bin/mythSetWakeupTime $time
Server halt command: /usr/bin/mythshutdown --shutdown
Pre Shutdown check-command: /usr/bin/mythshutdown --check

mythSetWakeupTime is just a simple script to put 0 in rtc then $1 and it
works fine, no problems there...


Mythwelcome:-

Command to set wakeup time: <blank>
Wakeup time format: yyyy-MM-dd hh:mm:ss
nvram-wakeup Restart Command: <blank>
Command to reboot: /sbin/reboot
Command to shutdown: /sbin/poweroff
Command to run Xterm: xterm
Command to run to start the Frontend: /usr/bin/mythfrontend

My theory is that you have to call mythshutdown --setwakeup for all this
to work properly. Note from above that I directly set the wakeup time
without going via mythshutdown. This is because its a pain in the ass
if you're trying to use RTC because it seems mythshutdown --setwakeup
wants date-time style input.

If that's the case then I'd guess this might work but I've already tried
lots of different guesses without luck. :(

Mythtv-setup:

Wakeup time format: yyyy-mm or whatever it is.
Command to set Wakeup Time: /usr/bin/mythshutdown --setwakeup $time

Mythwelcome:-

Command to set wakeup time: /usr/bin/someScript

...where someScript will have to take a date-time and convert it into
seconds since epoch.

Cheers for the help James,

Chris.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


James.Skimming at portraitsoftware

Sep 4, 2008, 3:09 PM

Post #6 of 10 (3388 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

Hi Chris,

You're correct, it needs to go through mythshutdown as it records the
wakeup time in the database, which it presumably uses at wakeup. Run
this SQL to see the setting in the database

mysql -D mythconverg -u mythtv -p --execute="SELECT * FROM settings
WHERE value = 'MythShutdownNextScheduled'"

Here's my settings:

Backend Settings
****************

Wakeup time format: yyyy-MM-ddThh:mm:ss
Set wakeuptime command: mythshutdown --setwakeup $time
Server halt command: sudo mythshutdown --shutdown
Pre Shutdown chack-command: mythshutdown --check

MythWelcome/Shutdown settings
*****************************

Command to Set Wakeup Time: sudo /usr/bin/MythWakeSet "$time"
Wakeup time format: yyyy-MM-dd hh:mm:ss
nvram-wakeup Restart Command: <not set>
Command to reboot: sudo shutdown -h -r now
Command to shutdown: sudo poweroff
Command to run Xterm: xterm
Command to run to start the Frontend: /usr/bin/mythfrontend --logfile
/var/log/mythtv/mythfrontend.log

My /usr/bin/MythWakeSet is simply
*************************************
echo $1 > /proc/acpi/alarm

Note the time formats, "mythshutdown --setwakeup" needs it like the W3C
format for DateTime (with a "T" in the middle) "yyyy-MM-ddThh:mm:ss". My
shutdown command needs it in the "yyyy-MM-dd hh:mm:ss" format but it
looks like yours needs in time_t.

Here's the guide I followed.

https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake

It wasn't completely correct for me, the MythWakeSet script in the guide
converts the date to UTC/GMT, whereas my system likes it in local time
(something I found out when we went into BST this year).

Let me know how you get on.

Cheers,

Jim.

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


chris at simmons

Sep 4, 2008, 11:49 PM

Post #7 of 10 (3380 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

James Skimming wrote:
> Hi Chris,
>
> You're correct, it needs to go through mythshutdown as it records the
> wakeup time in the database, which it presumably uses at wakeup. Run
> this SQL to see the setting in the database
>
> mysql -D mythconverg -u mythtv -p --execute="SELECT * FROM settings
> WHERE value = 'MythShutdownNextScheduled'"
>
> Here's my settings:
>
> Backend Settings
> ****************
>
> Wakeup time format: yyyy-MM-ddThh:mm:ss
> Set wakeuptime command: mythshutdown --setwakeup $time
> Server halt command: sudo mythshutdown --shutdown
> Pre Shutdown chack-command: mythshutdown --check
>
> MythWelcome/Shutdown settings
> *****************************
>
> Command to Set Wakeup Time: sudo /usr/bin/MythWakeSet "$time"
> Wakeup time format: yyyy-MM-dd hh:mm:ss
> nvram-wakeup Restart Command: <not set>
> Command to reboot: sudo shutdown -h -r now
> Command to shutdown: sudo poweroff
> Command to run Xterm: xterm
> Command to run to start the Frontend: /usr/bin/mythfrontend --logfile
> /var/log/mythtv/mythfrontend.log
>
> My /usr/bin/MythWakeSet is simply
> *************************************
> echo $1 > /proc/acpi/alarm
>
> Note the time formats, "mythshutdown --setwakeup" needs it like the W3C
> format for DateTime (with a "T" in the middle) "yyyy-MM-ddThh:mm:ss". My
> shutdown command needs it in the "yyyy-MM-dd hh:mm:ss" format but it
> looks like yours needs in time_t.
>
> Here's the guide I followed.
>
> https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake
>
> It wasn't completely correct for me, the MythWakeSet script in the guide
> converts the date to UTC/GMT, whereas my system likes it in local time
> (something I found out when we went into BST this year).
>
> Let me know how you get on.
>
> Cheers,
>
> Jim.
>
> _______________________________________________
>
>
Thanks, that explains it :) I'll just have to do some date munging then
I guess.

My box auto started last night and I got this:-

Startup command: echo $status > /home/myth/restartStatus gave "auto" (correct)

mythshutdown -p -v all says "looks like we were started manually1" (wrong!)

Oh dear... Sounds like this is a bug to me, there's clearly two
independent and different ways of determining if it was an auto start
and mythshutdown gets it wrong unless you use it for everything, which
is just extra hassle if you use RTC as then you have to do date
munging. Mythwelcome should be using the same logic as the backend is
when invoking the Startup command.

Chris.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


James.Skimming at portraitsoftware

Sep 5, 2008, 2:49 AM

Post #8 of 10 (3375 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

> Startup command: echo $status > /home/myth/restartStatus gave "auto"
(correct)
>
> mythshutdown -p -v all says "looks like we were started manually1"
(wrong!)
>
> Oh dear... Sounds like this is a bug to me, there's clearly two
> independent and different ways of determining if it was an auto start
> and mythshutdown gets it wrong unless you use it for everything, which

> is just extra hassle if you use RTC as then you have to do date
> munging. Mythwelcome should be using the same logic as the backend is

> when invoking the Startup command.

I don't know what the "$status" represents, so I can't say whether your
conclusion is correct, though there are messages in the backend logs
along the lines of "Looks like I was started manually" (I'm at work now
so can't give you the exact wording).

As far as the "two independent and different ways of determining if it
was an auto start", well, having worked on software for years, it just a
fact of life. Different people work on different areas of a system,
unless they both all have a complete holistic view of all the code, that
sort of thing is almost unavoidable. It doesn't necessarily mean there's
a bug, as each bit may be working as intended. As I don't know the
software internals, I can't say for certain whether it is a bug.

As for your date munging, are you not already doing what's necessary in
your equivalent? /usr/bin/mythSetWakeupTime

Mythshutdown can supply the shutdown command the same parameters as the
backend.

Jim.

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


chris at simmons

Sep 5, 2008, 5:17 AM

Post #9 of 10 (3365 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

The trouble is that rtc wants time since epoch whilst mythshutdown --setwakeup wants yyyy-MM-ddThh:mm:ss.

If you don't use mythshutdown its easy because you can choose time_t from mythtv-setup and just write it straight to the rtc. This is all my script has to do.

If you use mythshutdown then your script will get invoked with a date-time style date which requires munging.

This is hassle I'd rather avoid but seemingly can't because mythwelcome has its own special way of guessing whether it was an auto restart or user restart.

Anyway. Thanks for your help, much appreciated :)

I'm off on holiday for a week shortly which is why I started trying to get this working again, I didn't want the tv box on all week whilst I was away!

I'll see if I can find a bug when I get back. I was thinking of trying some mythtv devel so perhaps this would be a good starting place to try and sort this out.

Tata and thanks again for the help

Chris.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


James.Skimming at portraitsoftware

Sep 5, 2008, 5:49 AM

Post #10 of 10 (3353 views)
Permalink
Re: Mythwelcome always starts mythfrontend on boot. [In reply to]

> The trouble is that rtc wants time since epoch whilst mythshutdown
> --setwakeup wants yyyy-MM-ddThh:mm:ss.
>
> If you don't use mythshutdown its easy because you can choose time_t
> from mythtv-setup and just write it straight to the rtc. This is all
> my script has to do.

The information you pass to "mythshutdown --setwakeup" does not get
passed verbatim to your script. It's stored in the database.

When the backend finally calls "sudo mythshutdown --shutdown",
mythshutown retrieves the value from the database, to pass to your
script. If you set the following value in "MythWelcome/Shutdown
settings", it does the munging for you.

Wakeup time format: time_t

To debug things, run myth with the "--verbose <I can't remember the
level>" option, its logs will them appear in the backend's logs.

Prior to myth 0.21, I had the opposite problem, as mythshutown would
only supply the epoch time. It was originally designed to work with
nvram-wakeup. Now it's configurable between "time_t" (epoch) and
"yyyy-MM-dd hh:mm:ss".

So I don't think you need to do the munging.

Regards,

Jim.

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.