Hi !
Looks like vdr's shutdownskript hook is not properly working. Since it seems to be undocumented in vdr man page i took my information from here:
http://www.vdr-wiki.de/wiki/index.php/C%27t-VDR_-_Hooks
#!/bin/sh # Simple ACPI shutdown hook # $1 : Next timer seconds from 1970 from 1970/01/01, UTC # $2 : Next timer seconds from now # $3 : Next timer title # $4 : Shutdown forced
If the time is far enough in the future this is correct, if it is only few minutes in the future it gets horribly wrong (now +30 minutes or something similar) (The argument $1 is supplied wrong to the script)
This is vdr 1.7.10 . I remember that some people have written this is a known problem. But why is it happening ? Has somebody debugged this allready ?
On 22 Dec 2009, at 19:39, Steffen Barszus wrote:
Hi !
Looks like vdr's shutdownskript hook is not properly working. Since it seems to be undocumented in vdr man page i took my information from here:
http://www.vdr-wiki.de/wiki/index.php/C%27t-VDR_-_Hooks
#!/bin/sh # Simple ACPI shutdown hook # $1 : Next timer seconds from 1970 from 1970/01/01, UTC # $2 : Next timer seconds from now # $3 : Next timer title # $4 : Shutdown forced
If the time is far enough in the future this is correct, if it is only few minutes in the future it gets horribly wrong (now +30 minutes or something similar) (The argument $1 is supplied wrong to the script)
This is vdr 1.7.10 . I remember that some people have written this is a known problem. But why is it happening ? Has somebody debugged this allready ?
From the MANUAL:
Min. event timeout = 30 Min. user inactivity = 300 If the command line option '-s' has been set, VDR will automatically shutdown the computer if the next timer event is at least MinEventTimeout minutes in the future, and the user has been inactive for at least MinUserInactivity minutes. Setting MinUserInactivity to 0 disables the automatic shutdown, while still retaining the possibility to manually shutdown the computer.
There is your 30 mins. No bug, a 'feature'.
My VDR is set to these defaults. If I try to shutdown before 30 mins, I am prompted by VDR to press Power again to FORCE shutdown. If this is the case I cannot recall exactly but I think the wakeup is set to 30 mins from the forced shutdown, rather than the next timer.
If I recall a mailing list discussion there was an argument along the lines that if a timer was set to record in less than a certain value, 30 mins by default, it is 'cheaper' in terms of power and hardware shutdown/restart cycle degradation to keep the computer running.
I have not played with this setting so I cannot comment on VDR behaviour with a lower setting for this value. Please report back if you experiment.
Seasons Greetings,
Ian.
On 22 Dec 2009, at 21:36, Ian Bates wrote:
On 22 Dec 2009, at 19:39, Steffen Barszus wrote:
Hi !
Looks like vdr's shutdownskript hook is not properly working. Since it seems to be undocumented in vdr man page i took my information from here:
http://www.vdr-wiki.de/wiki/index.php/C%27t-VDR_-_Hooks
#!/bin/sh # Simple ACPI shutdown hook # $1 : Next timer seconds from 1970 from 1970/01/01, UTC # $2 : Next timer seconds from now # $3 : Next timer title # $4 : Shutdown forced
If the time is far enough in the future this is correct, if it is only few minutes in the future it gets horribly wrong (now +30 minutes or something similar) (The argument $1 is supplied wrong to the script)
This is vdr 1.7.10 . I remember that some people have written this is a known problem. But why is it happening ? Has somebody debugged this allready ?
From the MANUAL:
Min. event timeout = 30 Min. user inactivity = 300 If the command line option '-s' has been set, VDR will automatically shutdown the computer if the next timer event is at least MinEventTimeout minutes in the future, and the user has been inactive for at least MinUserInactivity minutes. Setting MinUserInactivity to 0 disables the automatic shutdown, while still retaining the possibility to manually shutdown the computer.
There is your 30 mins. No bug, a 'feature'.
My VDR is set to these defaults. If I try to shutdown before 30 mins, I am prompted by VDR to press Power again to FORCE shutdown. If this is the case I cannot recall exactly but I think the wakeup is set to 30 mins from the forced shutdown, rather than the next timer.
If I recall a mailing list discussion there was an argument along the lines that if a timer was set to record in less than a certain value, 30 mins by default, it is 'cheaper' in terms of power and hardware shutdown/restart cycle degradation to keep the computer running.
I have not played with this setting so I cannot comment on VDR behaviour with a lower setting for this value. Please report back if you experiment.
There is also a detailed section in the INSTALL document:
Automatic shutdown: -------------------
If you define a shutdown command via the '-s' command line option, VDR will call the given command if there is currently no recording or replay active, the user has been inactive for at least MinUserInactivity minutes and the next timer event is at least MinEventTimeout minutes in the future (see the Setup parameters in MANUAL).
The command given in the '-s' option will be called with five parameters.
The first one is the time (in UTC) of the next timer event or plugin wakeup time (as a time_t type number), and the second one is the number of seconds from the current time until the next timer event. Your program can choose which one to use for programming some sort of hardware device that makes sure the computer will be restarted in time before the next timer event. Your program must also initiate the actual shutdown procedure of the computer. VDR will not automatically exit after calling the shutdown program, but will rather continue normally until it receives a SIGTERM when the computer is actually shut down. So in case the shutdown fails, or the shutdown program for some reason decides not to perform a shutdown, VDR will stay up and running and will call the shutdown program again after a while. The command will be started in a separate background session, so it can continue to run even after VDR has terminated.
If there are currently no timers active and there is no plugin wakeup time, both parameters will be '0'. In that case the program shall not set the hardware for automatic restart and only perform the system shutdown. A program that uses the second parameter to set the hardware for restart must therefore also check whether the first parameter is '0'.
If the wakeup time is given by a timer, the third parameter will be the number of the channel that will be recorded, otherwise it will be 0. The fourth parameter contains the file name of the recording as defined in the timer, the name of the plugin that requested the wakeup time, or an empty string if no wakeup time is present. These can be used by the shutdown program to show that information on some display interface etc.
The fifth parameter indicates the reason why the shutdown was requested. '0' means this is an automatic shutdown due to some timeout, while '1' means that this is a user requested shutdown (resulting from pressing the "Power" key). The shutdown program may use this information to decide whether or not to actually perform the system shutdown.
If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
A sample shell script to be used with the '-s' option might look like this:
#!/bin/sh setRTCwakeup $(($1 - 300)) sudo halt
Here 'setRTCwakeup' would be some program that uses the first parameter (which is the absolute time of the next timer event) to set the Real Time Clock so that it wakes up the computer 5 minutes (i.e. 300 seconds) before that event. The 'sudo halt' command then shuts down the computer. You will have to substitute both commands with whatever applies to your particular hard- and software environment.
If the '-s' option is present, the VDR machine can be turned off by pressing the "Power" key on the remote control.
These documents are provided in the VDR source tarball. I use Slackware and 'roll my own' VDR, for a packaged distribution you may not have these documents or if you do they may not be where you can find them 'easily'.
Use the source Luke...
ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.10.tar.bz2
Seasons Greetings,
Ian.
Ian Bates schrieb:
On 22 Dec 2009, at 21:36, Ian Bates wrote:
On 22 Dec 2009, at 19:39, Steffen Barszus wrote:
Hi !
Looks like vdr's shutdownskript hook is not properly working. Since it seems to be undocumented in vdr man page i took my information from here:
http://www.vdr-wiki.de/wiki/index.php/C%27t-VDR_-_Hooks
#!/bin/sh # Simple ACPI shutdown hook # $1 : Next timer seconds from 1970 from 1970/01/01, UTC # $2 : Next timer seconds from now # $3 : Next timer title # $4 : Shutdown forced
If the time is far enough in the future this is correct, if it is only few minutes in the future it gets horribly wrong (now +30 minutes or something similar) (The argument $1 is supplied wrong to the script)
This is vdr 1.7.10 . I remember that some people have written this is a known problem. But why is it happening ? Has somebody debugged this allready ?
From the MANUAL:
Min. event timeout = 30 Min. user inactivity = 300 If the command line option '-s' has been set, VDR will automatically shutdown the computer if the next timer event is at least MinEventTimeout minutes in the future, and the user has been inactive for at least MinUserInactivity minutes. Setting MinUserInactivity to 0 disables the automatic shutdown, while still retaining the possibility to manually shutdown the computer.
There is your 30 mins. No bug, a 'feature'.
My VDR is set to these defaults. If I try to shutdown before 30 mins, I am prompted by VDR to press Power again to FORCE shutdown. If this is the case I cannot recall exactly but I think the wakeup is set to 30 mins from the forced shutdown, rather than the next timer.
If I recall a mailing list discussion there was an argument along the lines that if a timer was set to record in less than a certain value, 30 mins by default, it is 'cheaper' in terms of power and hardware shutdown/restart cycle degradation to keep the computer running.
I have not played with this setting so I cannot comment on VDR behaviour with a lower setting for this value. Please report back if you experiment.
There is also a detailed section in the INSTALL document:
Thanks i have to admit i only checked the manpages.
If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
So its really a "feature" - Whats the use case for this - except for the surprise ? Should a shutdown script try to "fix" that ?
These documents are provided in the VDR source tarball. I use Slackware and 'roll my own' VDR, for a packaged distribution you may not have these documents or if you do they may not be where you can find them 'easily'.
# locate vdr/INSTALL /usr/share/doc/vdr/INSTALL.gz
Looks like i searched not long enough.
Steffen Barszus schrieb:
Ian Bates schrieb:
There is also a detailed section in the INSTALL document:
Thanks i have to admit i only checked the manpages.
If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
So its really a "feature" - Whats the use case for this - except for the surprise ? Should a shutdown script try to "fix" that ?
To answer to myself - there should be at least any sign that the shutdown skript can differentiate between real timer 30+ min in the future or if this feature kicked in. This is not possible at the moment. I would prefer vdr is not calculating this and just providing the real time of the timer.
Someone who would have a problem with this ? Klaus, can this be changed ?
Kind Regards
Steffen
On 23.12.2009 13:14, Steffen Barszus wrote:
Steffen Barszus schrieb:
Ian Bates schrieb:
There is also a detailed section in the INSTALL document:
Thanks i have to admit i only checked the manpages.
If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
So its really a "feature" - Whats the use case for this - except for the surprise ? Should a shutdown script try to "fix" that ?
To answer to myself - there should be at least any sign that the shutdown skript can differentiate between real timer 30+ min in the future or if this feature kicked in. This is not possible at the moment. I would prefer vdr is not calculating this and just providing the real time of the timer.
Someone who would have a problem with this ? Klaus, can this be changed ?
At some point the shutdown mechanism apparently became "rocket science" and I decided to no longer touch it (especially since I don't even use it myself).
You may want to discuss this with Udo Richter udo_richter@gmx.de, because he wrote most of the shutdown handling code.
Klaus
Klaus Schmidinger schrieb:
On 23.12.2009 13:14, Steffen Barszus wrote:
Steffen Barszus schrieb:
Ian Bates schrieb:
There is also a detailed section in the INSTALL document:
Thanks i have to admit i only checked the manpages.
If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
So its really a "feature" - Whats the use case for this - except for the surprise ? Should a shutdown script try to "fix" that ?
To answer to myself - there should be at least any sign that the shutdown skript can differentiate between real timer 30+ min in the future or if this feature kicked in. This is not possible at the moment. I would prefer vdr is not calculating this and just providing the real time of the timer.
Someone who would have a problem with this ? Klaus, can this be changed ?
At some point the shutdown mechanism apparently became "rocket science" and I decided to no longer touch it (especially since I don't even use it myself).
You may want to discuss this with Udo Richter udo_richter@gmx.de, because he wrote most of the shutdown handling code.
Ok - thanks Klaus.
It should be least surprise principle - any complexity should be in the programm handling the shutdown. Allthough i appreciate the gap time feature, it should not mess around with the time for next wakeup.
Anyway - checking this with Udo.
On Wed, Dec 23, 2009 at 5:55 AM, Klaus Schmidinger Klaus.Schmidinger@tvdr.de wrote:
At some point the shutdown mechanism apparently became "rocket science" and I decided to no longer touch it (especially since I don't even use it myself).
;)
Personally I don't see any real reason to ever shut down/wakeup feature. Maybe that's useful for guys running VDR on laptops or old pc's that consume a lot of power(?). I only use VDR in my living room as my main tv/media source, and on a test box for messing around with but that's it. I don't actually watch tv on a computer monitor.
Am Donnerstag, den 24.12.2009, 20:00 -0800 schrieb VDR User:
On Wed, Dec 23, 2009 at 5:55 AM, Klaus Schmidinger Klaus.Schmidinger@tvdr.de wrote:
At some point the shutdown mechanism apparently became "rocket science" and I decided to no longer touch it (especially since I don't even use it myself).
;)
Personally I don't see any real reason to ever shut down/wakeup feature. Maybe that's useful for guys running VDR on laptops or old pc's that consume a lot of power(?). I only use VDR in my living room as my main tv/media source, and on a test box for messing around with but that's it. I don't actually watch tv on a computer monitor.
Sorry, I do not get your reasoning. Do you mean if a system uses less than 5 – or a different number – watts it does not need to be shut down?
On Fri, Dec 25, 2009 at 1:24 PM, Paul Menzel paulepanter@users.sourceforge.net wrote:
Am Donnerstag, den 24.12.2009, 20:00 -0800 schrieb VDR User:
On Wed, Dec 23, 2009 at 5:55 AM, Klaus Schmidinger Klaus.Schmidinger@tvdr.de wrote:
At some point the shutdown mechanism apparently became "rocket science" and I decided to no longer touch it (especially since I don't even use it myself).
;)
Personally I don't see any real reason to ever shut down/wakeup feature. Maybe that's useful for guys running VDR on laptops or old pc's that consume a lot of power(?). I only use VDR in my living room as my main tv/media source, and on a test box for messing around with but that's it. I don't actually watch tv on a computer monitor.
Sorry, I do not get your reasoning. Do you mean if a system uses less than 5 – or a different number – watts it does not need to be shut down?
Whether or not to shut it down is completely the decision of the user. But for example there might be some guys worried about running their laptop battery down so they prefer to shut it down. Or some guy who is really concerned with his power usage in general and wants everything off if he isn't using it.
However, in my case since VDR is my main tv/media source, it would be annoying to have to boot the computer every time someone wanted to watch/listen to something, therefore the box stays on 24/7. Thus, never having use for shutting down.
Am Freitag, den 25.12.2009, 13:38 -0800 schrieb VDR User:
[…]
However, in my case since VDR is my main tv/media source, it would be annoying to have to boot the computer every time someone wanted to watch/listen to something, therefore the box stays on 24/7. Thus, never having use for shutting down.
Well, I guess energy prices are still too low.
Paul Menzel wrote:
Am Freitag, den 25.12.2009, 13:38 -0800 schrieb VDR User:
[…]
However, in my case since VDR is my main tv/media source, it would be annoying to have to boot the computer every time someone wanted to watch/listen to something, therefore the box stays on 24/7. Thus, never having use for shutting down.
Well, I guess energy prices are still too low.
Really stupid comment, maybe you also believe that food is too cheap if people can afford to eat.
Am Samstag, den 26.12.2009, 07:53 +0200 schrieb Lauri Tischler:
Paul Menzel wrote:
Am Freitag, den 25.12.2009, 13:38 -0800 schrieb VDR User:
[…]
However, in my case since VDR is my main tv/media source, it would be annoying to have to boot the computer every time someone wanted to watch/listen to something, therefore the box stays on 24/7. Thus, never having use for shutting down.
Well, I guess energy prices are still too low.
Really stupid comment, maybe you also believe that food is too cheap if people can afford to eat.
Sorry, I will not insult you, but I do not understand your analogy. Of course I do not believe that.
I did not write, energy prices are too low because people can afford to run electrical systems.
I will not write anything further regarding this topic because that does not belong to this list. If you want to we can discuss this off-list.
VDR User schrieb:
On Wed, Dec 23, 2009 at 5:55 AM, Klaus Schmidinger Klaus.Schmidinger@tvdr.de wrote:
At some point the shutdown mechanism apparently became "rocket science" and I decided to no longer touch it (especially since I don't even use it myself).
;)
Personally I don't see any real reason to ever shut down/wakeup feature. Maybe that's useful for guys running VDR on laptops or old pc's that consume a lot of power(?). I only use VDR in my living room as my main tv/media source, and on a test box for messing around with but that's it. I don't actually watch tv on a computer monitor.
Well, i can wait the 8 seconds (well with Bios maybe 15 sec) the machine needs to boot. I don't know what you consider a lot of power (here 60-100W depending on apps running - anyway it doesn't matter where you put the bar), but what you say sounds like i don't care about environment/ other people, which is provocative and sounds ignorant for some people at the place where i live.
There are 8-10 hours where i sleep and another 8-10 hours where i am at work, which is at least 16 hours of 3W power consumption - i don't need the VDR running at that time, as long as my recordings are taken care off. If i should need it from external, i can wake it up by WOL.
Think about it !
Anyway lets keep any further discussion about that off-list.
Kind Regards
Steffen
Am 22.12.2009 23:59, schrieb Steffen Barszus:
Ian Bates schrieb:
On 22 Dec 2009, at 21:36, Ian Bates wrote: If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
So its really a "feature" - Whats the use case for this - except for the surprise ? Should a shutdown script try to "fix" that ?
There are several cases: 1. Timer more than 30min in the future - no problem with that.
2. Timer less than 30min in the future - In that case, the critical question is whether VDR can complete a whole shutdown within that time. Worst case may be that VDR will never wake up on its own, because VDR is still shutting down at the wakeup time.
3. Timer is running - What time should be the best time to wake up? The internal functions of VDR currently cannot even determine the next timer, only the first (running) timer.
Other concerns: If you force shutdown to do maintenance, you might be surprised by a waking up VDR five minutes later. (You probably just forgot to unplug power, right?)
The current solution was a compromise that was realizable with not too much effort. The 30mins were simply long enough and a better value than never to wake up at all.
From today's point of view, I would probably prefer a solution that
wakes up at the next timer that is more than 30min in the future, however this requires a better GetNextActiveTimer function.
Cheers,
Udo
Am 10.01.2010 22:36, schrieb Udo Richter:
Am 22.12.2009 23:59, schrieb Steffen Barszus:
Ian Bates schrieb:
On 22 Dec 2009, at 21:36, Ian Bates wrote: If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the first and second parameter will correspond to a time that is "Min. event timeout" minutes in the future.
Before the shutdown program is called, the user will be prompted to inform him that the system is about to shut down. If any remote control key is pressed while this prompt is visible, the shutdown will be cancelled (and tried again later). The shutdown prompt will be displayed for 5 minutes, which should be enough time for the user to react.
So its really a "feature" - Whats the use case for this - except for the surprise ? Should a shutdown script try to "fix" that ?
There are several cases:
- Timer more than 30min in the future
- no problem with that.
agree
- Timer less than 30min in the future
- In that case, the critical question is whether VDR can complete a
whole shutdown within that time. Worst case may be that VDR will never wake up on its own, because VDR is still shutting down at the wakeup time.
That is some special requirement then, which should be handled in shutdown script. Even worse from shutdown script you can not find out whats happening (real timer time or changed one)
- Timer is running
- What time should be the best time to wake up? The internal functions
of VDR currently cannot even determine the next timer, only the first (running) timer.
This should deliver not running but next timer. - not sure how feasible that is.
Other concerns: If you force shutdown to do maintenance, you might be surprised by a waking up VDR five minutes later. (You probably just forgot to unplug power, right?)
We should not increase complexity to cover some not likely situations.
The current solution was a compromise that was realizable with not too much effort. The 30mins were simply long enough and a better value than never to wake up at all.
I would like less complexity and least surprise. I think this checking should be done in the shutdownscript.
From today's point of view, I would probably prefer a solution that
wakes up at the next timer that is more than 30min in the future, however this requires a better GetNextActiveTimer function.
I'll think again about it ...
Am 10.01.2010 23:31, schrieb Steffen Barszus:
Am 10.01.2010 22:36, schrieb Udo Richter:
- Timer less than 30min in the future
- In that case, the critical question is whether VDR can complete a
whole shutdown within that time. Worst case may be that VDR will never wake up on its own, because VDR is still shutting down at the wakeup time.
That is some special requirement then, which should be handled in shutdown script. Even worse from shutdown script you can not find out whats happening (real timer time or changed one)
Actually, there's no guarantee that its an timer at all. For example, the exec-Plugin can set a wakeup time that will be reported here too, provide this wakeup time is before all other timers.
Cheers,
Udo