Author Topic: prevent vdr from shutdown  (Read 4011 times)

Offline kdeiss

  • Full Member
  • ***
  • Posts: 49
    • View Profile
prevent vdr from shutdown
« on: October 04, 2005, 10:34:00 »
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

Offline Chris

  • Administrator
  • Hero Member
  • *****
  • Posts: 543
    • View Profile
    • Email
Re: prevent vdr from shutdown
« Reply #1 on: October 26, 2005, 23:28:36 »
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.

Offline Wesie

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: prevent vdr from shutdown
« Reply #2 on: November 01, 2005, 10:47:12 »
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.   


Offline kdeiss

  • Full Member
  • ***
  • Posts: 49
    • View Profile
Re: prevent vdr from shutdown
« Reply #3 on: November 06, 2005, 17:05:13 »
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