View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 24 posts ] 
Go to page Previous  1, 2

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject:
PostPosted: Sun Nov 20, 2005 8:53 am 
Offline
Joined: Sun Oct 30, 2005 2:30 pm
Posts: 13
Hi all,

??? http://mythtv.org/pipermail/mythtv-users/2004-October/056101.html ???

Quote:
Also, in reviewing the previous posts, I wonder how you are testing this? If you are just manually setting a wakeup time for something a few minutes form now, then the computer will come on, but that start-time is not related to when myth needs to reboot. Thus, the backend thinks it is a user start and not and auto start and so doesn't kill the frontend. Does that make sense?

To test this, you'll have to wait for it to AUTOMATICALLY shutdown and wakeup all on its own.


hmm... see /var/log/mythtv/mythbackend.log:
Code:
2005-11-20 14:46:23.878 Reschedule requested for id 13.
2005-11-20 14:46:24.018 Scheduled 2 items in 0.1 = 0.05 match + 0.09 place
2005-11-20 14:46:40.055 I'm idle now... shutdown will occur in 60 seconds.
2005-11-20 14:46:49.074 50 secs left to system shutdown!
2005-11-20 14:46:59.095 40 secs left to system shutdown!
2005-11-20 14:47:09.116 30 secs left to system shutdown!
2005-11-20 14:47:19.138 20 secs left to system shutdown!
2005-11-20 14:47:29.159 10 secs left to system shutdown!

All values are displayed as they are stored in the nvram/rtc.
(and do not correspond necessarily to the system date/time)

WakeUp  : Enabled (0x80)
Day     : 20 (0x14)
Hour    : 12 (0x0C)
Minute  : 36 (0xE4)
Second  : 03 (0x03)
rtcDay  : 20 (0x20)
rtcHour : 12
rtcMin  : 36
rtcSec  : 03
Checksum: 0xB8DB

Enabling (0x80) WakeUp-on-RTC in nvram.
New Day     : 20 (0x14)
New Hour    : 14 (0x0E)
New Minute  : 52 (0xF4)
New Second  : 39 (0x27)
New rtcDay  : 20 (0x20)
New rtcHour : 14
New rtcMin  : 52
New rtcSec  : 39
New Checksum: 0xB911

Now really WRITING into /dev/nvram...
And setting RTC alarm into /dev/rtc...

   The changes to take effect, you must reboot your computer now.

Starting up as the master server.
2005-11-20 14:53:48.685 mythbackend version: 0.17.20050130-1 www.mythtv.org
2005-11-20 14:53:48.690 Enabled verbose msgs : important general
2005-11-20 14:53:50.686 Reschedule requested for id -1.
2005-11-20 14:53:50.878 Scheduled 1 items in 0.2 = 0.13 match + 0.06 place
2005-11-20 14:53:51.932 I'm idle now... shutdown will occur in 60 seconds.
2005-11-20 14:54:01.099 50 secs left to system shutdown!
2005-11-20 14:54:07.450 MainServer::HandleAnnounce Playback
2005-11-20 14:54:07.464 adding: mythtv as a client (events: 0)
2005-11-20 14:54:08.021 MainServer::HandleAnnounce Playback
2005-11-20 14:54:08.024 adding: mythtv as a client (events: 1)
2005-11-20 15:00:02.843 Started recording "1 ARD" on channel: 1 on cardid: 1, sourceid 1
2005-11-20 15:00:02.933 Changing from None to RecordingOnly
2005-11-20 15:00:03.009 Unknown video codec
2005-11-20 15:00:03.011 Please go into the TV Settings, Recording Profiles and
2005-11-20 15:00:03.013 setup the four 'Software Encoders' profiles.
2005-11-20 15:00:03.014 Assuming RTjpeg for now.
2005-11-20 15:00:03.015 NVR: Error, unknown audio codec
2005-11-20 15:05:00.045 Finished recording 1 ARD on channel: 1
2005-11-20 15:05:00.103 Changing from RecordingOnly to None
2005-11-20 15:05:00.103 Reschedule requested for id 0.
2005-11-20 15:05:00.345 Scheduled 1 items in 0.2 = 0.00 match + 0.18 place



nano /var/log/mythtv/waketest.log
Code:
wakeuptest called with user.


???


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 1:22 pm 
Offline
Joined: Sun May 22, 2005 2:44 pm
Posts: 105
Location: The Netherlands
Hi andrewsw,

Thanks for your nice modification of the script! I do not understand the log of the backend:
Quote:
2005-11-20 14:53:51.932 I'm idle now... shutdown will occur in 60 seconds.
2005-11-20 14:54:01.099 50 secs left to system shutdown!
2005-11-20 14:54:07.450 MainServer::HandleAnnounce Playback
2005-11-20 14:54:07.464 adding: mythtv as a client (events: 0)
2005-11-20 14:54:08.021 MainServer::HandleAnnounce Playback
2005-11-20 14:54:08.024 adding: mythtv as a client (events: 1)
2005-11-20 15:00:02.843 Started recording "1 ARD" on channel: 1 on cardid: 1, sourceid 1


Is the backend shutting down before a client (mythtv) is added? I thought that checking the item 'disable shutdown before client connected' would prevent such behavior?

Hi Brucelee100,
According to the link and the follow-up in this thread you should check the idle wait for recording time in the mythtv-setup, is it more than 6 minutes / 360 seconds? Is the item 'disable shutdown before client connected' really checked???

Maybe you should wait for an answer of andrewsw.

Regards,
Fiete


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 2:31 pm 
Offline
Joined: Sat Sep 24, 2005 4:45 pm
Posts: 42
fiete --

yeah, the backend is seeing idle before the frontend connects to it. I had this problem for a while and solved it by turning off hotplug ( I wasn't using it anyway) and that sped up my boot enough that it wouldn't see idle. That check box should do it too, I suppose, unless it is just broken...

brucelee100 --

there is something strange going on here. according to the output of the waketest.log it thinks this is a user , not auto, startup. so there is some problem there.

try

cat /var/log/mythtv/mythbackend.log | grep user

and

cat /var/log/mythtv/mythbackend.log | grep auto

(it might be "User" and "Auto"), you should see a series of both auto and user startups, or only one or only the other. I'm just curious whether it differentiates at all between the two startups.

also you should set the "idle wait for recording time" to something reasonable like 15 minutes or so. You've got it shutting down and then coming back up in like 3 minutes and that may be causing confusion.

If this doesn't sort itself out pretty shortly we can try another method where your startup script determines if its user or auto startup and we can just ignore mythtv's version of this. very easy change.

A

_________________
ASUS A7N8X-E Deluxe
Hauppauge 350/150
ASUS V9520Magic/128MB Geforce FX5200
Maxtor DiamondMax 10 6L200R0 200GB
AMD Athlon XP 2800+ Barton


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 2:59 pm 
Offline
Joined: Sun Oct 30, 2005 2:30 pm
Posts: 13
nano /var/log/mythtv/waketest.log
Code:
...
wakeuptest called with auto.


Quote:
you should check the idle wait for recording time in the mythtv-setup, is it more than 6 minutes / 360 seconds?


I think that am the solution for the problem

Quote:
Is the item 'disable shutdown before client connected' really checked???


I have forgotten, to activate again :oops:

:shock: YES :D now poweroff after finished record!

nano /var/log/mythtv/mythbackend.de:
Code:
...
Starting up as the master server.
2005-11-20 21:17:01.540 mythbackend version: 0.17.20050130-1 www.mythtv.org
2005-11-20 21:17:01.544 Enabled verbose msgs : important general
2005-11-20 21:17:03.541 Reschedule requested for id -1.
2005-11-20 21:17:03.730 Scheduled 1 items in 0.2 = 0.13 match + 0.06 place
2005-11-20 21:17:03.736 Recording starts soon, AUTO-Startup assumed
2005-11-20 21:17:21.348 MainServer::HandleAnnounce Playback
2005-11-20 21:17:21.362 adding: mythtv as a client (events: 0)
2005-11-20 21:17:21.907 MainServer::HandleAnnounce Playback
2005-11-20 21:17:21.909 adding: mythtv as a client (events: 1)
2005-11-20 21:25:02.899 Started recording "1 ARD" on channel: 1 on cardid: 1, sourceid 1
2005-11-20 21:25:03.006 Changing from None to RecordingOnly
2005-11-20 21:25:03.083 Unknown video codec
2005-11-20 21:25:03.085 Please go into the TV Settings, Recording Profiles and
2005-11-20 21:25:03.086 setup the four 'Software Encoders' profiles.
2005-11-20 21:25:03.087 Assuming RTjpeg for now.
2005-11-20 21:25:03.088 NVR: Error, unknown audio codec
2005-11-20 21:36:00.044 Finished recording 1 ARD on channel: 1
2005-11-20 21:36:00.094 Changing from RecordingOnly to None
2005-11-20 21:36:00.094 Reschedule requested for id 0.
2005-11-20 21:36:00.232 Scheduled 1 items in 0.1 = 0.02 match + 0.12 place
2005-11-20 21:36:02.260 I'm idle now... shutdown will occur in 360 seconds.
2005-11-20 21:36:11.280 350 secs left to system shutdown!
2005-11-20 21:36:21.301 340 secs left to system shutdown!
2005-11-20 21:36:31.321 330 secs left to system shutdown!
2005-11-20 21:36:41.343 320 secs left to system shutdown!
2005-11-20 21:36:51.363 310 secs left to system shutdown!
2005-11-20 21:37:01.385 300 secs left to system shutdown!
2005-11-20 21:37:11.405 290 secs left to system shutdown!
2005-11-20 21:37:21.426 280 secs left to system shutdown!
2005-11-20 21:37:31.446 270 secs left to system shutdown!
2005-11-20 21:37:41.468 260 secs left to system shutdown!
2005-11-20 21:37:51.488 250 secs left to system shutdown!
2005-11-20 21:38:01.517 240 secs left to system shutdown!
2005-11-20 21:38:11.539 230 secs left to system shutdown!
2005-11-20 21:38:21.560 220 secs left to system shutdown!
2005-11-20 21:38:31.582 210 secs left to system shutdown!
2005-11-20 21:38:41.602 200 secs left to system shutdown!
2005-11-20 21:38:51.622 190 secs left to system shutdown!
2005-11-20 21:39:01.642 180 secs left to system shutdown!
2005-11-20 21:39:11.663 170 secs left to system shutdown!
2005-11-20 21:39:21.683 160 secs left to system shutdown!
2005-11-20 21:39:31.704 150 secs left to system shutdown!
2005-11-20 21:39:41.726 140 secs left to system shutdown!
2005-11-20 21:39:51.746 130 secs left to system shutdown!
2005-11-20 21:40:01.767 120 secs left to system shutdown!
2005-11-20 21:40:11.787 110 secs left to system shutdown!
2005-11-20 21:40:21.807 100 secs left to system shutdown!
2005-11-20 21:40:31.827 90 secs left to system shutdown!
2005-11-20 21:40:41.848 80 secs left to system shutdown!
2005-11-20 21:40:51.868 70 secs left to system shutdown!
2005-11-20 21:41:01.889 60 secs left to system shutdown!
2005-11-20 21:41:11.910 50 secs left to system shutdown!
2005-11-20 21:41:21.930 40 secs left to system shutdown!
2005-11-20 21:41:31.952 30 secs left to system shutdown!
2005-11-20 21:41:41.972 20 secs left to system shutdown!
2005-11-20 21:41:51.993 10 secs left to system shutdown!



All Big THANKS !!!!


Last edited by brucelee100 on Mon Nov 21, 2005 9:21 am, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 3:36 pm 
Offline
Joined: Sat Sep 24, 2005 4:45 pm
Posts: 42
I'm just going to post this. try it out if you like. Its what I now use for wakeup testing. My problem has been that we like to turn on the mythbox in the evening to watch some recorded shows. This time is usually pretty close to the time we are automatically recording shows. So we turn on the box and mythbackend THINKS its an auto start because there is some recording coming up soon and then the wake test sees "auto" and kills the front end. very annoying. I wanted tighter control over "auto" and "user". I now record the start-up time to a file when I set the nvram-wakeup. then my wakeuptest script compares "now" to that recorded time and makes it own decision as to whether its a "user" or "auto" start. I'm sure there are implications about this that may affect others, but it works for me. ymmv.

here it is

knoppmyth-wakeuptest.pl
Code:
#!/usr/bin/perl
# This script can be called when the mythtv backend starts to
# determine whether the frontend should be shutdown.
#
# If this boot was an automatic wakeup because there is something
# to record, the frontend is shutdown to allow the backend to
# shutdown the computer when it is done recording.
#
# Imporant:  In mythtv-setup, this script should be set up to
# be called in the background (with a trailing &) because of the
# sleep.
open wakelog, '>> /var/log/mythtv/wakelog';

$kill_frontend = "killall mythfrontend";
$sleep_time = 30;
$now_time_display = `date`;
$now_time = `date +%s`;

$boot_time = `cat /var/log/mythtv/wakeuptime`;
chomp ($now_time);
chomp ($boot_time);
$boot_time -= 300;

print wakelog "Wakeup test has been called at $now_time, $now_time_display.\n";
print wakelog "Original boot time(-300) was $boot_time.\n";

# Now the work starts...

if ($now_time > $boot_time) {
   print wakelog "It is later than boot time, AUTO wake assumed.\n";
   sleep $sleep_time;
   system "$kill_frontend";
}
else {
   print wakelog "We are waking early, USER wake-up assumed.\n";
}

close wakelog;


nvram-wakeup sets the actual wakeup time to 5 minutes before the time value passed to it. This allows time for booting up and fsck etc so that machine is definitely up and ready to go before the time you need it to be ready. the script above gets the wakeup time stored in /var/log/mythtv/wakeuptime, subtracts 300 seconds (five minutes) and compares it to now. if it is currently less than 5 minutes before the original wakeup time then we assume auto startup, otherwise user startup. In other words, if it is now anytime earlier than 5 minutes before $requested_wakeup_time in script below, then it must be a user wakeup. This gives tighter control over what is considered user or auto. you can tweak the $boot_time -= 300; as you desire to make it even tighter if you like.

the other change you need is this:

knoppmyth-nvram.pl
Code:

# This is the command to set the wakeup time.  If you have custom parameters,
# put them here.  Be careful as this writes to ROM!
$nvram_cmd  = "sudo nvram-wakeup";

# Some motherboards do not have a day in the wakeup time, therefore, the
# max number of days that the wakeup can be in the future is 1 day.  Most
# do not have a month.  In that case set this to 28.
# Note, the backend won't shutdown on a wakeup at max_wakeup_wakeup_days
# because it has nothing to record and assumes a "user" start.  Right
# now I just have something recorded regularly each day.  I'll post a
# fix for this when I have it.
$max_wakeup_days = 1;

# If you want a regular wakeup for cron jobs etc.  Set to 0 to disable.
# Note 1: Do not use a time between 23:45 and 00:15 as there are some
# race conditions around midnight.
# Note 2: If you use $regular_wakeup_time_text to start up to handle a
# cron job, that cron job must shut the system down by killing the front
# end when it is done.  That way, the next wakeup time gets set.
# Note 3: nvram wakeup sets the wakeup for 5 minutes before the actual
# request to give the computer time to boot.  However, if the computer
# does a diskscan on a large disk, it may take longer than this and you
# miss the cron window.  I set $regular_wakeup_time_text to be 10 mins
# before my cron job runs.
# Examples:
# For daily at 1am:
# $regular_wakeup_days = 1;
# $regular_wakeup_time_text = "01:00";
# For weekly, on Sunday at 1am:
# $regular_wakeup_days = 7;
# $regular_wakeup_time_text = "Sun 01:00";
$regular_wakeup_days = 0;
$regular_wakeup_time_text = "05:50";

# Now the real work...

$requested_wakeup_time = @ARGV[0];
$now_time = `date +%s`;
$max_wakeup_time = $now_time + $max_wakeup_days * 24 * 60 * 60;
$min_wakeup_time = $now_time + 10 * 60;

if ($requested_wakeup_time) {
   if ($requested_wakeup_time < $min_wakeup_time) {
      $requested_wakeup_time = $min_wakeup_time;
   }

}

if ($regular_wakeup_days) {
   $regular_wakeup_time = `date +%s -d "$regular_wakeup_time_text"`;
   if ($regular_wakeup_time < $now_time) {
      $regular_wakeup_time = $regular_wakeup_time +
($regular_wakeup_days * 24 * 60 * 60);
   }
   if ($regular_wakeup_time > $min_wakeup_time) {
      if ($regular_wakeup_time < $requested_wakeup_time) {
         $requested_wakeup_time = $regular_wakeup_time;
      }
      if (!$requested_wakeup_time) {
         $requested_wakeup_time = $regular_wakeup_time;
      }
   }
}
if ($max_wakeup_time < $requested_wakeup_time) {
   $requested_wakeup_time = $max_wakeup_time;
}

# this is it, set the wake-up time
# warning, this writes to the bios ROM. danger
system("$nvram_cmd -s $requested_wakeup_time");
system("echo $requested_wakeup_time > /var/log/mythtv/wakeuptime");
# paranoia
sleep 10;


this sets the nvram-wakeup but also echoes that wakeuptime to a file for later comparison.

I haven't tested this heavily on my system yet, but it seems to work. also, I am no kind of perl guy and if someone wants to make it really tight and obfuscated, go for it...

brucelee100 -- if your backend is having trouble determining "user" and "auto" startup, this may solve your problem for you. let me know if it helps.

A

_________________
ASUS A7N8X-E Deluxe
Hauppauge 350/150
ASUS V9520Magic/128MB Geforce FX5200
Maxtor DiamondMax 10 6L200R0 200GB
AMD Athlon XP 2800+ Barton


Top
 Profile  
 
 Post subject: Detect remote frontend?
PostPosted: Fri Dec 02, 2005 4:55 am 
Offline
Joined: Sun May 22, 2005 2:44 pm
Posts: 105
Location: The Netherlands
Hi andrewsw,

Just wondering: I'm frequently using a remote frontend. This remote frontend starts the server using WOL. Most of the time the servers assumes to be woken up by 'user'. Well, this is true, but the 'user' is remote. So the local frontend will not automatically shut down. After finishing remote watching a show I have to SSH to the server, manually kill server frontend. Then the server will shut down.
Is it possible to detect a remote frontend and then decide whether the local frontend may or may not shut down?
My kids and wife won't use ssh in a XTERM.....
Regards,

Fiete


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:38 pm 
Offline
Joined: Sat Sep 24, 2005 4:45 pm
Posts: 42
my understanding is that the backend will detect the presence of remote frontends and not go idle while they are attached.

try this. boot up remote frontend and when it boots up the backend, go kill the frontend on the backend machine (who's on first? I dunno! Third base!). Anyway, that should leave the backend up until you kill that remote frontend.

If that works out in your testing, then what I'd suggest is edit your startup scripts on your backend to NOT start a front end on that machine. If you have a remote control on that machine, you could map one of the remote control keys to Alt-M which is the easy way to start a front end. Then if anyone wants to watch on that machine, they'll have to start the frontend themselves, but its nice and easy.

make sense?

A

_________________
ASUS A7N8X-E Deluxe
Hauppauge 350/150
ASUS V9520Magic/128MB Geforce FX5200
Maxtor DiamondMax 10 6L200R0 200GB
AMD Athlon XP 2800+ Barton


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 1:54 pm 
Offline
Joined: Sun May 22, 2005 2:44 pm
Posts: 105
Location: The Netherlands
Hi andrewsw,

Thanks, very practical solution! I've just to figure out what will happen in case of automatic boot (for scheduled recording) since I have checked 'prevent shut down before client connect'. My understanding is that the box will not shutdown after finishing the recording.

Thanks.

Fiete


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 6:20 pm 
Offline
Joined: Sat Sep 24, 2005 4:45 pm
Posts: 42
You're right, I hadn't thought of that (I only have one box).

I think there are a couple possible solutions to this.

1) uncheck the prevent shutdown before client connect box and make sure your timeout is set long enough to get the front end up if you want to use it (maybe something like 5 minutes just incase someone walks away during boot)

or

2) Can you differentiate between a net boot of the backend by a remotefront and an AUTO boot and a USER boot? if so, set up your wake up test script to handle each of these options. if its a net boot, then just kill the front end, if its an auto boot, kill the front end, if its a local USER boot, then start the front end. Leave the "prevent shutdown before client connect" checked. You might be able to set up something simple like:

touch a file like "netboot" on one of your nfs shares on the backend. Then as part of your scripts on the remote frontend, include an 'echo yes > insert sharenamehere/netboot' Then test that in your wakeup script. Also include a 'rm -f netboot; touch netboot' or some similar sequence in the startup script to clear that out.

I've not played with a net boot and don't know the particulars, but I think that would be fairly easy. If you've got any coding background at all, just flowchart the thing and it'll be obvious.

or how about this:

can you differentiate in the logs (/var/log/mythtv/mythbackend.log) whether its a local or remote boot? I bet you can, in which case just tail | grep the log for the appropriate string and use that to determine your reason for boot. that along with the usual AUTO/USER detection should work too...

let me know how it works out.

A

_________________
ASUS A7N8X-E Deluxe
Hauppauge 350/150
ASUS V9520Magic/128MB Geforce FX5200
Maxtor DiamondMax 10 6L200R0 200GB
AMD Athlon XP 2800+ Barton


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ] 
Go to page Previous  1, 2



All times are UTC - 6 hours




Who is online

Users browsing this forum: Bing [Bot] and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu