Req Shutdown cooperation
#1
I have XBMC and VDR running on the same machine. So they must agree when to shutdown and when to stay. If they run on different machines, everything is OK and each system decides on its own when to shutdown.

Currently XBMC has a idleTimer which quits XBMC (or executes a shutdown) when no key has been pressed for a configurable number of minutes.

VDR has minuserinactivity which executes a shutdown script, when it gets idle. As long as XBMC is connected, it will not get idle and stay alive.

PROBLEM:
When XBMC gets idle, it quits and shutdowns the machine and potentially stops VDR recording something currently or does not program ACPI to wakeup the machine, when the next recording starts.

PROPOSAL:
IF XBMC and VDR are running on the same machine, THEN XBMC should not get idle if there is currently a recording going on or there is a recording within the next 15 minutes starting (configurable). If he decides to shutdown, then it should call a user script given the next recording time to allow programming of ACPI. This would mean, that we move the shutdown logic from VDR to XBMC.

-or-

IF XBMC and VDR are running on the same machine, THEN XBMC should ask VDR (through VNSI) if it could shutdown before doing this. If VDR answers "NO", then no shutdown should be done. If VDR says "YES" (and all others who are asked), then XBMC should tell VDR to shutdown and give it some time to go down before shutting down. This would mean, we keep whatever shutdown logic is in VDR and allow them to cooperate.

-or-

The user should completely disable all automatic shutdowns from XBMC and VDR and write a script running completely independent of XBMC and VDR and asks both system for their idle time and decide for both systems, when to go done and does all what is necessary.

What do you think?
Reply
#2
For myself I have chosen your last option. In most cases you need a script anyway for programming ACPI or in my case a timer integrated in the IR receiver.
I fire up a daemon with startup of VDR which listens to lirc. After a configurable time of user inactivity it initiates shutdown sequence. This checks for VDR's next timer (via svdrpsend). In case next timer is only 15 min away, shutdown will be suspended after recording has finished. Same works for recordings, the daemon shuts down the system after recording has finished.

It's not an easy task getting this behavior implemented with generic methods working with all backends (remote or on the same machine)

If you are interested I can provide my scripts and the code for the daemon.

Reply
#3
Yes, would be helpful to see your code. Thanks!
Reply
#4
This is the code of autoswtichoff, a daemon I start after vdr:
http://xbmclogs.com/show.php?id=32053

vdr-timer.pl, a Perl script for checking next vdr timer and setting ACPI:
http://xbmclogs.com/show.php?id=32056

A snippet of a script I use for launching and shutdown. This also gets called from irexec:
Code:
elif [ "$1" = "poweroff" ];then
     kill_apps
     /usr/bin/perl /usr/local/bin/vdr-timer.pl test 240
     retval=$?
     if [ $retval -eq 0 ]; then
       sudo stop lirc
       /usr/bin/perl /usr/local/bin/vdr-timer.pl
       sudo poweroff
     else
       zenity --info --text "Timer active! System will automatically shut down after recording" &
     fi

irexec:
http://xbmclogs.com/show.php?id=32060

Reply
#5
http://forum.xbmc.org/showthread.php?tid...t=shutdown

There is also the service.vdr.powersafe addon available, using it successfully here. Only thing missing to make it perfect would be stopping idle timer when there is a certain amount of network activity but you can't have everything I guess. Big Grin
Reply
#6
Information 
FernetMenta, the links you provided no longer work... I've been creating my own script to achieve a shutdown if no timer is actived / will be actived soon and there is no VDR user connected to my backend OpenElec system. So I'm very interested to see what you did there, would be great if you could share it Big Grin
Reply
#7
I call this perl script : http://www.xbmclogs.com/show.php?id=32267

1)
from a running daemon which checks IR activity

2)
from a irexec config when pressing a combination of 2 buttons.

The perl script uses svdrpsend to query vdr for the next timer.
Reply

Logout Mark Read Team Forum Stats Members Help
Shutdown cooperation0