News:

Latest versions:
Server plugin: 0.5.1
MVP dongle: 0.5.2
Raspberry Pi client: 0.5.2
Windows client: 0.5.2-1

Main Menu

prevent vdr from shutdown

Started by kdeiss, October 04, 2005, 10:34:00

Previous topic - Next topic

kdeiss

I have a feature request: If the automatic shutdown feature on vdr is enabled (menu//setting/other/min. user inactivity > 0)  it will shutdown, even if a mediamvp client still is active (live-tv or recording). There are two possibilities to prevent this:

a) directly in the plugin
b) with a shutdown-hook script

a) only could be done by the develteam, solution b) is realised by scriting, but in this case the script has to detect that there are active clients. I played around something with netstat, but can't detect some usefull information.

Any idea?

Thanks

Klaus

Chris

I would vote for putting code in the actual plugin to prevent VDR from shutting down, but I havn't seen any reference in the code or VDR docs to VDR checking the plugins before shutting down.

Wesie

Hmmm, check for plugin ... I don't know....
It is possible to write in the /var/tmp directory e.g. a small file "MVPisON", if the MVP connected to the VDR. This small file can be check via script and the VDR will not shut down.
Only the way to delete the file needs to be going through the brain.
I think its not enough, if the file will be delete, if the MVP goes off ( e.g. Network problems, reboot ... ) or does the VOMP Server know at every moment, if the MVP active ( on and not in standby) ?

If not:

It is possibel, that the MVP send a small status every e.g.15 min. to the VOMP Server, if he active. If the Server received this one. he did not delete this file.If this MSG missing 2 times + e.g. 5min. he delete the File and the VDR can shutdown.   


kdeiss

I did it that way:

change line 51 in mvpserver.c to

  log.init(Log::DEBUG, "/tmp/vompserver.log", 1);

so the plugin will create a log-file in /tmp.

create a shellscript (shutdown-hook script) -in my case in /usr/share/vdr/shutdown-hooks/shutdown82.vomp.sh

###########################################################

#!/bin/bash
JOBFIL="/tmp/vompserver.log"

if [ ! -f $JOBFIL ]
then
    echo $JOBFIL not found ! Creating empty one !!!
    touch $JOBFIL
fi

let LINES=0
LINES=`cat $JOBFIL | wc -l` 
if [ $LINES -gt 0 ]
then
    logger -t $0 "vompserver activ - cancel shutdown ..."
    TRY_AGAIN=10
    cp ${JOBFIL}.002 ${JOBFIL}.003 2>/dev/null
    cp ${JOBFIL}.001 ${JOBFIL}.002 2>/dev/null
    cp $JOBFIL ${JOBFIL}.001 2>/dev/null
    cat /dev/null > $JOBFIL
else
    logger -t $0 "vompserver not activ, bye..."
fi

###########################################################

It's not a very advanced method, but working really good....

klaus