Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: How can i tell if dvb drivers are properly loaded ?




Klaus Schmidinger wrote:
> Martin Hoffmann wrote:
> 
>>Nice !
>>
>>I've implemented this and as far as i can tell it works ! Great !
>>
>>Just another question: Do VDRs internal watchdog timers always work ? Or could
>>it happen that vdr just hangs and will not automatically exit ?
>>
>>So, does it make sense to create an external script which checks for VDR still
>>reacting on port 2001 ? Or is this nonsense, since VDR would detect it's own
>>hanging process and do an emergency exit ?
> 
> 
> The watchdog "should" catch all hangups, but what in this live is 100% sure...?
> 
> Klaus

I found it does not (at least my vdr doesn't :( )

I use this script:

----------------------SNIP-----------------------------------

#!/bin/bash
#
# VDR watchdog. Start this script as a cron job every minute
#
# */1   * * * *   root  test -x /usr/local/src/VDRtmp/vdr-watchdog.sh \ 
  #                            && /usr/local/src/VDRtmp/vdr-watchdog.sh
#


# Is our VDR still alive ?
# ( It may be busy with cutting or encoding, so a timeout of 5 seconds
#   to respond should be sufficient )
#
/bin/echo -e "QUIT\n" \
   | /usr/bin/netcat -w 10 localhost 2001 \
   | grep -nie "VDR"

if test $? -eq 0
then
         # Everything is ok
         #
         exit 0
else
         # No, damn, it's gone... Recheck and if still dead,
         # restart it...
         #
         logger "*** VDR WATCHDOG: POSSIBLE HANG. RETRYING..."

         # flag whether VDR seems to be alive or not
         # first assumption is: It's dead (Jim ;-) )
         ALIVE=0

         # retry 10 times
         #
         for l in $(seq 1 10)
         do
                 logger "*** VDR WATCHDOG: RETRY #${l}..."
                 if test ${ALIVE} -eq 0
                 then
                         /bin/echo -e "QUIT\n"|/usr/bin/netcat -w 5 \ 
                             localhost 2001 | grep -nie "VDR"
                         if test $? -eq 0
                         then
                                 ALIVE=1
                         fi
                 fi
         done
         if test ${ALIVE} -eq 0
         then
                 sh /sbin/svdr stop
                 sleep 2
                 sh /sbin/svdr start
                 sendEmail -q -f vdr@linvdr.org -t you@youraddress.com \
                   -u "***VDR WATCHDOG: POSSIBLE HANG.RESTART FORCED !" \
                   -s yourmailserver -m "$(date)"
                 logger "*** VDR WATCHDOG: HANG. RESTART FORCED !"
         fi
fi

----------------------SNAP-----------------------------------

PS: You don't really need sendEmail, I'm just using it to get informed
     if I'm at work or so... Unfortunately, I receive (too) many "RESTART
     FORCED" eMails...


BTW: @Klaus Schmidinger: The vdr short hangs I reported came from
      either TECH=1 or STREAMING=1. I recompiled without these options
      and (at least) these hangs are gone :)
      Thanks for your help anyway

-- 
with best regards
---
Karsten Mueller
Softwaredevelopment / Keyaccount Manager
RATIO Entwicklungen GmbH
Admiralitaetstr. 59
20459 Hamburg
Email: mailto:kmu@ratio.de





Home | Main Index | Thread Index