Runvdr

Aus VDR Wiki
Wechseln zu: Navigation, Suche

Scripts / Tools

[1] http://www.informatik.uni-bremen.de/cgi-bin/cgiwrap/mwiesner/download/watchvdr
[2] ftp://ftp.berlios.de/pub/avm-capi4linux/temp/cooker/dvb
[3] http://linvdr.org/download/doku/vdr-2/runvdr
[4] http://www.tja.org/dvb/runvideo-rc
[5] http://www.tja.org/dvb/runvideo
[6] http://sites.inka.de/~bigred/sw/vdr.html Daemon
[7] http://www.leo.org/~loescher/tipsdata/runvdr in Perl
[8] ftp://ftp.heise.de/pub/ct/listings/0308-202.zip für mehrere VDR Instanzen

Sample

 #!/bin/sh
 #
 # sample runvdr script
 #
 # runvdr: Loads the DVB driver and runs VDR
 #
 # If VDR exits abnormally, the driver will be reloaded
 # and VDR restarted.
 #
 # original by Klaus Schmidinger
 # adapted and enhanced for VDR-Install-Script
 #
 # $Id: runvdr 1.12 2004/01/09 16:19:26 kls Exp $
 # VDR needs to run in non-UTF8 locale
 export LC_CTYPE=POSIX
 export TERM=linux
 export HOME=/root
 # workaround for problems with NPTL ("Native Posix Thread Library")
 export LD_ASSUME_KERNEL=2.4
 export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/src/vdradmin:/tftpboot
 DESC="Digital Videorecorder"
 CONF="/usr/local/src/VDRtmp/vdr.conf"
 source "${CONF}"
 KERNELV=( `uname -rv` )
 VERSION=( `grep -s 'define VDRVERSION' $MYPATH/VDR/config.h` )
 COLUMNS=( `stty size 2>/dev/null` )
 VDRPRG="${MYPATH}/VDR/vdr"
 test -x "${VDRPRG}" || exit 1
 colmsg() {
     printf "%-$[${COLUMNS[1]:-60}-11]s%-0s\n" "${1}" "${2}"
 }
 testmod() {
     test `/sbin/lsmod|grep -wc ^${1}` -eq 0
 }
 testproc() {
     test "`which ${1}`" -a ! "$(ps axc|awk "{if (\$5==\"$1\") print \$1}")"
 }
 load_conf() {
     for i in `sed '/="/!d;s/=.*\"//;/^#/d' "${CONF}"` ; do
         eval x="\$${i}"
         test "${x}" -a "${i%_*}" = VDR && {
             VDROPT=${VDROPT}" --`echo "${i##*\_}"|tr A-Z a-z`='${x}'"
         }
         export ${i}="${x}"
     done
 }
 load_cmds() {
     for i in commands reccmds ; do
         grep -qs ^ "${CMDPATH}"/${i}* && {
             echo "cat "`ls -v "${CMDPATH}"/${i}*`" > \"${VDR_CONFIG}/${i}.conf\"" | sh
         }
     done
 }
 stop_dvb() {
     echo ${START_PROCS}|egrep -q dvb && {
         for i in "." ". ." ". . ." ; do
             echo -ne "Shutting down DVB: ${i}\r"
             sleep 1s
         done
         if [ -d "${MYPATH}/DVB/driver" ] ; then
             cd ${MYPATH}/DVB/driver; make rmmod CARDS="${CARDS}"
         elif [ -e "${MYPATH}/DVB/${KERNELV[0]:0:3}/fdump" ] ; then
             cd ${MYPATH}/DVB/build-${KERNELV[0]:0:3}; ./insmod.sh unload
         elif [ "${RMODULES}" ] ; then
             modules -rq "${RMODULES}"
         elif [ -x /etc/init.d/dvb ] ; then
             /etc/init.d/dvb stop
         else
             :
         fi
     }
 }
 start_dvb() {
     echo ${START_PROCS}|egrep -q dvb && {
         echo "Starting DVB: "
         if [ -d "${MYPATH}/DVB/driver" ] ; then
             cd ${MYPATH}/DVB/driver; make insmod CARDS="${CARDS}"
         elif [ -e "${MYPATH}/DVB/${KERNELV[0]:0:3}/fdump" ] ; then
             cd ${MYPATH}/DVB/build-${KERNELV[0]:0:3}; ./insmod.sh load
         elif [ "${RMODULES}" ] ; then
             modules -rq "${RMODULES}"
         elif [ -x /etc/init.d/dvb ] ; then
             /etc/init.d/dvb start
         else
             :
         fi
     }
 }
 modules() {
     echo "${2}" | sed '/^[ ]*$/d' | \
     while read i ; do
         /sbin/modprobe ${1} ${i} >/dev/null 2>&1
         case $? in
              0) colmsg "${i}" done ;;
              1) colmsg "${i}" failed ;;
         esac
     done
 }
 load_dvb() {
     testmod dvb && {
         start_dvb
         test "${TUNE}" = yes && testproc szap && {
             szap -c "${VDR_CONFIG}/tune/channels.conf-dvbs-astra" -x -a 1 -n 1
         }
     }
 }
 load_atd() {
     testproc atd && { atd; }
 }
 load_ivtv() {
     testmod ivtv && { cd "${MYPATH}/ivtv/utils"; ./runivtv; }
 }
 load_dxr3() {
     testmod em8300 && { cd "${MYPATH}/em8300/modules"; ./ldm; } 
 }
 load_lcdd() {
     testproc LCDd && { LCDd -c /etc/LCDd.conf; } &
 }
 load_lircd() {
     testproc lircd && { setserial /dev/ttyS0 uart none; /sbin/modprobe lirc_serial; lircd; } &
     wait $!
 }
 load_irexec() {
     testproc irexec && { irexec /etc/lircrc; } &
 }
 load_admind() {
     testproc vdradmind.pl && { rm -f "${MYPATH}/vdradmin/vdradmind.pid"; sleep ${ADMINDELAY}; vdradmind.pl; } &
 }
 load_mvploader() {
     testproc mvploader && { mvploader /tftpboot/dongle.bin; } &
 }
 load_evexec() {
     testproc evexec && {
         grep -s ^[0-9]: "${EVEXECCNF}" | \
         while IFS=: read a b c ; do
             evexec /dev/input/event${a} ${b} "${c}" 2>/dev/null &
         done
     }
 }
 case "${1}" in
   start)
       for cmd in conf cmds ${START_PROCS} ; do
           load_${cmd}
           test ${cmd} = evexec && {
               RELOAD_EVEXEC="yes"
           }
       done
       while (true) ; do
           test -e "${SYSLOG}" -a -e "${VDR_CONFIG}/setup.conf" && {
               CHAN=$(tail -n 300 ${SYSLOG}|sed "/${PHRASE}/!d;s#^.* ##"|sed '$!d')
               test -n "${CHAN##*[^0-9,-]*}" && {
                   sed -i "s/^CurrentChannel.*/CurrentChannel = ${CHAN}/" "${VDR_CONFIG}/setup.conf"
               }
           }
           test -f "${VDR_CONFIG}/loadkeys/${AV7110LOADKEYS}" \
                -a "`which av7110_loadkeys`" -a \
                -w /proc/av7110_ir && {
                   av7110_loadkeys "${VDR_CONFIG}/loadkeys/${AV7110LOADKEYS}" > /proc/av7110_ir
           }
           test -x "${VDR_LIB}/libvdr-pluginsetup.so.${VERSION[2]//\"}" && {
               PSETUP="-P'pluginsetup'"
           }
           echo "Starting ${DESC} ${VERSION[2]//\"}: "
           PLUGINS="${PSETUP} `grep -s - "${VDR_CONFIG}/plugins/plugin_setup_runvdr.conf"`"
           su ${VDRUSR} -c "${VDRPRG} ${VDROPT} ${USRDEV} ${PLUGINS}"
           test $? -eq 0 -o $? -eq 2 && {
               exit 1
           }
           date
           echo "Restarting ${DESC}: "
           killall -q -TERM ${VDRPRG}
           date
           stop_dvb
           start_dvb
           test "${RELOAD_EVEXEC}" = yes && {
               load_evexec
           }
       done
       ;;
   stop)
       for i in ${STOP_PROCS} ; do
           test "$(ps axc|awk "{if (\$5==\"$i\") print \$1}")" && {
               killall -v ${i}
           }
       done
       stop_dvb
       ;;
   xineclient)
       testproc xine && {
           xine -A alsa "vdr://tmp/vdr-xine/stream#demux:mpeg_pes"
       }
       ;;
   fbxineclient)
       testproc fbxine && {
           fbxine -A alsa "vdr://tmp/vdr-xine/stream#demux:mpeg_pes"
       }

;;

   restart)
       ${0} stop
       ${0} start
       ;;
   status)
       for i in ${STOP_PROCS} ; do
           test "$(ps axc|awk "{if (\$5==\"$i\") print \$1}")"
           case $? in
                0) colmsg "${i}" running ;;
                1) colmsg "${i}" unused ;;
           esac
       done
       ;;
   *)
       echo "Usage: ${0} {start|stop|status|restart}" >&2
       exit 1
       ;;
 esac