Hi,
does vdr (especially version 1.4.7 as I am using this right now) tell the shutdownscript in any way what caused the shutdown-request (pressing the poweroff button on fb or the idle timer)?
I am asking this cause I switched from 24/7 to nvram-wakeup and it (in the form it is implemented today) failed the waf-test. My wife (and somehow me too) does not like the behaviour of VDR that there is no way to choose a timeperiod where the idletimer is inactive. Let's say you like the comfort of 24/7 but nevertheless want to save some energy. Normally vdr is not used between 0:00 and 8:00, so it could be off at these times (but only if no recordings are to be done). During 8:01 - 23:59 we don't want vdr to idle-shutdown (but manual shutdowns should still work).
For this it would be nice to have a) a direct vdr feature (like no idletimer from x to y (and maybe more than one range)) or b) a way to distinguish between manual shutdown and idletimer shutdown in the shutdownscript.
Today we can choose between a) a long idletimeout (but that also leads to long unused uptimes in the middle of the night after a recording) b) short idletimeout (which is annoying cause you always have to tell vdr to keep alive) c) a shutdown-hook that disables shutdowns from 8-24 (which a) still can't stop the annoying message to appear on screen and b) will stop manual shutdowns from working too)
So somehow I see a missing feature here ;)
Many thanks for your answers, Norbert
Norbert Goebel wrote:
does vdr (especially version 1.4.7 as I am using this right now) tell the shutdownscript in any way what caused the shutdown-request (pressing the poweroff button on fb or the idle timer)?
See the INSTALL file of VDR. The 5'th parameter of the shutdown script is 0 for automatic shutdown and 1 for manual shutdown.
For this it would be nice to have a) a direct vdr feature (like no idletimer from x to y (and maybe more than one range))
You could try to modify the min. user inactivity parameter via SVDRP key actions or by a simple plugin to switch the behavior. A plugin could also report 'fake' activity at daytime to keep VDR from shutting down. From 1.5.1 on, or with the shutdown backport for 1.4.x, plugins can also influence the idle timings directly to 'fake' an interactive user at daytime.
c) a shutdown-hook that disables shutdowns from 8-24 (which a) still can't stop the annoying message to appear on screen
You can get rid of these messages by sending some unimportant key code (kUser9 for example) via SVDRP from the shutdown script to stop VDR from calling shutdown too often.
Cheers,
Udo
Norbert Goebel wrote:
Hi,
does vdr (especially version 1.4.7 as I am using this right now) tell the shutdownscript in any way what caused the shutdown-request (pressing the poweroff button on fb or the idle timer)?
[..]
For this it would be nice to have a) a direct vdr feature (like no idletimer from x to y (and maybe more than one range)) or b) a way to distinguish between manual shutdown and idletimer shutdown in the shutdownscript.
simply write an intelligent shutdownscript.
mine does:
(only snippets)
if [ "`ps aux | grep noad | grep -v 'grep noad'`" != "" ]; then logger -t vdr "not shutting down, noad is running"
if [ "`smbstatus -p | grep -c 192.168.42`" != "0" ]; then logger -t vdr "not shutting down, samba-users are connected" exit 1 fi
if [ "`w -hs | wc -l`" != "0" ]; then logger -t vdr "not shutting down, users are connected" exit 1 fi
simply do a timecheck. if its ok to shutdown, do it with an wakeuptime of $5 or if its a manual shutdown without timer, with a wakeuptime of `date -d "tomorrow 8am" +"%s"`
you can script vdr very well, imho.
regards, Friedhem.
Friedhelm Büscher schrieb:
simply write an intelligent shutdownscript.
mine does:
(only snippets)
if [ "`ps aux | grep noad | grep -v 'grep noad'`" != "" ]; then logger -t vdr "not shutting down, noad is running"
if [ "`smbstatus -p | grep -c 192.168.42`" != "0" ]; then logger -t vdr "not shutting down, samba-users are connected" exit 1 fi
if [ "`w -hs | wc -l`" != "0" ]; then logger -t vdr "not shutting down, users are connected" exit 1 fi
simply do a timecheck. if its ok to shutdown, do it with an wakeuptime of $5 or if its a manual shutdown without timer, with a wakeuptime of `date -d "tomorrow 8am" +"%s"`
you can script vdr very well, imho.
regards, Friedhem.
Hi,
as always it's a problem of knowing how to do what you want to do. I for example am trying and trying to get rid of the onscreen message "Taste drücken, um Ausschalten abzubrechen" automatically, but somehow commands like $svdrpsend HITK Ok > /dev/nulll & with svdrpsend=/usr/lib/vdr/svdrpsend.pl
do not get through to vdr when issued in a shutdown-hook script (debian vdr), but work flawlessly when issued by hand. Any suggestions on that problem?
My biggest problem might be understanding how to make an intelligent shutdownscript for vdr and there are almost no examples given - if you got a longer "example" I would be glad to learn from it ;)
Regards, Norbert
Norbert Goebel wrote:
as always it's a problem of knowing how to do what you want to do. I for example am trying and trying to get rid of the onscreen message "Taste drücken, um Ausschalten abzubrechen" automatically, but somehow commands like $svdrpsend HITK Ok > /dev/nulll & with svdrpsend=/usr/lib/vdr/svdrpsend.pl
do not get through to vdr when issued in a shutdown-hook script (debian vdr), but work flawlessly when issued by hand. Any suggestions on that problem?
let me guess: it gets a timeout? VDR is busy waiting for the shutdownscript to return, so no new svdr-connection is accepted. Spawn the svdrpsend (with at, if you like) and your problems will vanish.
My biggest problem might be understanding how to make an intelligent shutdownscript for vdr and there are almost no examples given - if you got a longer "example" I would be glad to learn from it ;)
my shutdownscript consists of the some lines above and some ssh-commands to my house-controlling (NSLU2), which tracks, which computer is online and offline, and which computer wants to wakeup when (via wake-on-lan). I don't know if this would be helpful, since its quite complex.
regards, Friedhelm.
Friedhelm Büscher schrieb:
let me guess: it gets a timeout? VDR is busy waiting for the shutdownscript to return, so no new svdr-connection is accepted. Spawn the svdrpsend (with at, if you like) and your problems will vanish.
Sorry, but you guessed wrong ;) Like written before I was mislead by my own assumptions about the order in which the "maybe"-shutdown-sequence is handled.
I guessed that a) the shutdown abort by keypress message is displayed b) the shutdown-hooks are called c) after b) finishes with exit 0 the timeout from a) is waited for and only than a shutdown happens
And even this order is somehow strange, as it displays an annoying message that might not even be needed.
But atm it seems like the order is: a) the shutdown abort by keypress message is displayed b) the timeout of 5! minutes is waited for c) after that timeout passes the shutdown-hooks are checked
I just changed my S90.custom shutdownhook to just "exit 1" and set the idletimeout to 1 minute und my log shows: Jul 16 17:05:45 video vdr: [4146] confirm: Taste drücken, um Ausschalten abzubrechen Jul 16 17:05:45 video vdr: [4146] warning: Taste drücken, um Ausschalten abzubrechen ... Jul 16 17:10:46 video vdr: [4146] confirmed Jul 16 17:10:46 video vdr-shutdown: executing /usr/share/vdr/shutdown-hooks/S50.noad as shell script Jul 16 17:10:46 video vdr-shutdown: executing /usr/share/vdr/shutdown-hooks/S50.vdrconvert as shell script Jul 16 17:10:47 video vdr-shutdown: executing /usr/share/vdr/shutdown-hooks/S90.custom as shell script Jul 16 17:10:47 video vdr-shutdown: Shutdown aborted by /usr/share/vdr/shutdown-hooks/S90.custom with exitcode 1 Jul 16 17:10:50 video vdr: [4146] connect from 127.0.0.1, port 45439 - accepted Jul 16 17:10:50 video vdr: [4146] SVDRP message: 'Shutdown abgebrochen / Shutdown aborted!' Jul 16 17:10:50 video vdr: [4146] info: Shutdown abgebrochen / Shutdown aborted! Jul 16 17:10:50 video vdr: [4146] closing SVDRP connection
Which leads to the question: Why is this done in this order and not like this:
a) check the shutdown-hooks and if those exit with exitcode=0 do b) else abort the shutdown sequence without a message (exception: the script wants to be verbose and does it itself) b) display shutdown abort message c) wait for the timeout and shutdown if it happens
Regards, Norbert
Norbert Goebel wrote:
Why is this done in this order and not like this:
a) check the shutdown-hooks and if those exit with exitcode=0 do b) else abort the shutdown sequence without a message (exception: the script wants to be verbose and does it itself) b) display shutdown abort message c) wait for the timeout and shutdown if it happens
The purpose of the shutdown script has never been to report whether shutdown is possible or not. The only purpose of the shutdown script is to shut down the computer and kill VDR, or do nothing. There was never any return code defined that indicates shutdown-readiness, nor was the return code ever checked.
Your strategy would therefore be a completely new shutdown script that is more like a check-for-activity script, and that would still require another script that actually does the shutdown after all.
Such a functionality could also be implemented by a simple plugin that reports plugin activity based on return codes from an external script.
I for example am trying and trying to get rid of the onscreen message "Taste drücken, um Ausschalten abzubrechen" automatically
btw, since VDR 1.5.1 (or 1.4.x with the shutdown rewrite patch), this message got replaced by a fancier "VDR will shut down in x:xx minutes" message, that counts down in 10-second steps, and that does no longer block most of VDR for 5 minutes.
Cheers,
Udo
Udo Richter schrieb:
Norbert Goebel wrote:
Why is this done in this order and not like this:
a) check the shutdown-hooks and if those exit with exitcode=0 do b) else abort the shutdown sequence without a message (exception: the script wants to be verbose and does it itself) b) display shutdown abort message c) wait for the timeout and shutdown if it happens
The purpose of the shutdown script has never been to report whether shutdown is possible or not. The only purpose of the shutdown script is to shut down the computer and kill VDR, or do nothing. There was never any return code defined that indicates shutdown-readiness, nor was the return code ever checked.
Your strategy would therefore be a completely new shutdown script that is more like a check-for-activity script, and that would still require another script that actually does the shutdown after all.
It was not exactly my idea to do it this way. I just checked the facilities c't vdr (or let's say e-tobis debian vdr-packages) offered me. And this contained the shutdown-hooks with one so called "S90.custom" shutdown-hook which - as the only example given - tells me how to abort a shutdown - so it sounded to me that those shutdown-hooks are made to do exactly what I tried to do. Seems like I was mislead by this "nice" example ;)
Such a functionality could also be implemented by a simple plugin that reports plugin activity based on return codes from an external script.
As I am not familiar with vdr plugin programming it was easier to create a shellscript that gets checked periodically via cron and after deciding that vdr should not automatically shut down sends a HITK User9 with SVDRP (User9 is not used anywhere else on my vdr). That way it's easy to include other checks (like network activity) too. But surely a nice plugin with settings changeable via vdr-menu instead of changing vars in a shellscript would still be nice ;)
So until someone else writes such a plugin or I find the time to do it myself (which might take years ;) ) the problem is solved for me.
Thx for all that helped finding a solution for the problem.
Regards, Norbert
Norbert Goebel schrieb:
Hi,
as always it's a problem of knowing how to do what you want to do. I for example am trying and trying to get rid of the onscreen message "Taste drücken, um Ausschalten abzubrechen" automatically, but somehow commands like $svdrpsend HITK Ok > /dev/nulll & with svdrpsend=/usr/lib/vdr/svdrpsend.pl
do not get through to vdr when issued in a shutdown-hook script (debian vdr), but work flawlessly when issued by hand. Any suggestions on that problem?
My biggest problem might be understanding how to make an intelligent shutdownscript for vdr and there are almost no examples given - if you got a longer "example" I would be glad to learn from it ;)
Regards, Norbert
Hi,
after some more trial and error I recognized, that the shutdown-hooks are called after the timeout for a key-press to abort the shutdown by hand has accured. This leads to 5 minutes "Taste drücken, um Ausschalten abzubrechen" being displayed on screen, so sending a key with svdrp to kill this annoying message (at least in times where a shutdown is not allowed due to shutdown-hooks) is no option. Even trying to handle the situation in a shutdown-hook at all is no option as they seem to be called after the "key-press to abort shutdown"-timeout.
Seems like I have to options to work around this a) with a cron script sending svdrp HITK messages every minute as long as shutdowns are not wanted b) with a plugin creating fake activity while shutdowns are not wanted
Regards, Norbert