Runvdr

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(M)
K (Hob den Schutz von „Runvdr“ auf)
 
(57 dazwischenliegende Versionen von 39 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
==Scripts / Tools==
+
==Beschreibung==
{|
+
{{Box Datei | [[Struktur|$SOURCEDIR]]/VDR/runvdr |
| [1]
+
<pre>
| http://www.informatik.uni-bremen.de/cgi-bin/cgiwrap/mwiesner/download/watchvdr
+
#!/bin/sh
|-
+
| [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
+
|}
+
  
==Sample==
+
# runvdr: Loads the DVB driver and runs VDR
  #!/bin/sh
+
#
  #
+
# If VDR exits abnormally, the driver will be reloaded
  # sample runvdr script
+
# and VDR restarted.
  #
+
#
  # runvdr: Loads the DVB driver and runs VDR
+
# In order to actually use this script you need to implement
  #
+
# the functions DriverLoaded(), LoadDriver() and UnloadDriver()
  # If VDR exits abnormally, the driver will be reloaded
+
# and maybe adjust the VDRPRG and VDRCMD to your particular
  # and VDR restarted.
+
# requirements.
  #
+
#
  # original by Klaus Schmidinger
+
# Since this script loads the DVB driver, it must be started
  # adapted and enhanced for [[Installscript|VDR-Install-Script]]
+
# as user 'root'. Add the option "-u username" to run VDR
  #
+
# under the given user name.
  # $Id: runvdr 1.12 2004/01/09 16:19:26 kls Exp $
+
#
 +
# Any command line parameters will be passed on to the
 +
# actual 'vdr' program.
 +
#
 +
# See the main source file 'vdr.c' for copyright information and
 +
# how to reach the author.
 +
#
 +
# $Id: runvdr 1.19 2006/05/14 16:02:05 kls Exp $
  
  # VDR needs to run in non-UTF8 locale
+
VDRPRG="./vdr"
  export LC_CTYPE=POSIX
+
VDRCMD="$VDRPRG -w 60 $*"
  export TERM=linux
+
  export HOME=/root
+
  # workaround for problems with NPTL ("Native Posix Thread Library")
+
  export LD_ASSUME_KERNEL=2.4
+
  export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/src/vdradmind:/tftpboot
+
  
  DESC="Digital Videorecorder"
+
KILL="/usr/bin/killall -q -TERM"
  CONF="/usr/local/src/VDRtmp/[[vdr.conf]]"
+
  
  source "${CONF}"
+
# Detect whether the DVB driver is already loaded
 +
# and return 0 if it *is* loaded, 1 if not:
 +
function DriverLoaded()
 +
{
 +
  return 1
 +
}
  
  KERNELV=( `uname -rv` )
+
# Load all DVB driver modules needed for your hardware:
  VERSION=( `grep -s 'define VDRVERSION' $MYPATH/VDR/config.h` )
+
function LoadDriver()
  COLUMNS=( `stty size 2>/dev/null` )
+
{
 +
}
  
  VDRPRG="${MYPATH}/VDR/vdr"
+
# Unload all DVB driver modules loaded in LoadDriver():
  test -x "${VDRPRG}" || exit 1
+
function UnloadDriver()
 +
{
 +
}
  
  colmsg() {
+
# Load driver if it hasn't been loaded already:
      printf "%-$[${COLUMNS[1]:-60}-11]s%-0s\n" "${1}" "${2}"
+
if ! DriverLoaded; then
  }
+
  LoadDriver
 +
  fi
  
  testmod() {
+
while (true) do
       test `/sbin/lsmod|grep -wc ^${1}` -eq 0
+
       eval "$VDRCMD"
  }
+
       if test $? -eq 0 -o $? -eq 2; then exit; fi
 
+
       echo "`date` reloading DVB driver"
  testproc() {
+
      $KILL $VDRPRG
       test "`which ${1}`" -a `ps -eo%c|grep -wc ^${1}` -eq 0
+
      sleep 10
  }
+
      UnloadDriver
 
+
      LoadDriver
  load_conf() {
+
      echo "`date` restarting VDR"
       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
 
       done
  }
+
</pre>
 +
}}
  
  load_cmds() {
+
Beispiel Funktionen, für den aktuellen DVB Treiber [[DVB Installation v4l-dvb]].
      for i in commands reccmds ; do
+
          grep -qs ^ "${CMDPATH}"/${i}* && {
+
              echo "cat "`ls -v "${CMDPATH}"/${i}*`" > \"${VDR_CONFIG}/${i}.conf\"" | sh
+
          }
+
      done
+
  }
+
  
  stop_dvb() {
+
function DriverLoaded()
      echo ${START_PROCS}|egrep -q dvb && {
+
{
          for i in "." ". ." ". . ." ; do
+
    grep -qse dvb[-_]core /proc/modules
              echo -ne "Shutting down DVB: ${i}\r"
+
}
              sleep 1s
+
          done
+
# Load all DVB driver modules needed for your hardware:
          # way 1:
+
function LoadDriver()
          cd ${MYPATH}/DVB/driver; make rmmod CARDS="${CARDS}"
+
{
          # way 2:
+
    make -C "[[Struktur|$SOURCEDIR]]/DVB/v4l" load
          #modules -rq "${RMODULES}"
+
}
          # way 3:
+
          #/etc/init.d/dvb stop
+
# Unload all DVB driver modules loaded in LoadDriver():
          # way 4:
+
function UnloadDriver()
          #cd ${MYPATH}/DVB/build-<KERNELVERSION>; ./insmod.sh unload
+
{
      }
+
    make -C "[[Struktur|$SOURCEDIR]]/DVB/v4l" unload
  }
+
}
  
  start_dvb() {
+
==Scripts / Tools==
      echo ${START_PROCS}|egrep -q dvb && {
+
# [http://www.informatik.uni-bremen.de/cgi-bin/cgiwrap/mwiesner/download/watchvdr watchvdr]
          echo "Starting DVB: "
+
# [ftp://ftp.berlios.de/pub/avm-capi4linux/temp/cooker/dvb]
          # way 1:
+
# [http://linvdr.org/download/doku/vdr-2/runvdr runvdr von Linvdr]
          cd ${MYPATH}/DVB/driver; make insmod CARDS="${CARDS}"
+
# [http://www.tja.org/dvb/runvideo-rc runvideo-rc]
          way 2:
+
# [http://www.tja.org/dvb/runvideo runvideo]
          #modules -q "${LMODULES}"
+
# [http://sites.inka.de/~bigred/sw/vdr.html Daemon]
          # way 3:
+
# [http://www.leo.org/~loescher/tipsdata/runvdr Perl]
          #/etc/init.d/dvb start
+
# [ftp://ftp.heise.de/pub/ct/listings/0308-202.zip für mehrere VDR Instanzen]
          # way 4:
+
# [http://www.errror.org/vdr Errror]
          #cd ${MYPATH}/DVB/build-<KERNELVERSION>; ./insmod.sh load
+
# [http://www.udo-richter.de/vdr/scripts.en.html runvdr-extreme]
      }
+
  }
+
 
+
  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}/vdradmind/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]//\"}: "
+
[[Kategorie:Skripte]]
            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
+
            ps -eo%c|grep -q ^${i}$ && {
+
                killall -v ${i}
+
            }
+
        done
+
        stop_dvb
+
        ;;
+
    xineclient)
+
        testproc xine && {
+
            xine -A alsa "vdr://tmp/vdr-xine/stream#demux:mpeg_pes"
+
        }
+
        ;;
+
    restart)
+
        ${0} stop
+
        ${0} start
+
        ;;
+
    status)
+
        for i in ${STOP_PROCS} ; do
+
            ps -eo%c|grep -q ^${i}$
+
            case $? in
+
                0) colmsg "${i}" running ;;
+
                1) colmsg "${i}" unused ;;
+
            esac
+
        done
+
        ;;
+
    *)
+
        echo "Usage: ${0} {start|stop|status|restart}" >&2
+
        exit 1
+
        ;;
+
  esac
+

Aktuelle Version vom 5. März 2011, 12:00 Uhr

[Bearbeiten] Beschreibung

Datei
$SOURCEDIR/VDR/runvdr
#!/bin/sh

# runvdr: Loads the DVB driver and runs VDR
#
# If VDR exits abnormally, the driver will be reloaded
# and VDR restarted.
#
# In order to actually use this script you need to implement
# the functions DriverLoaded(), LoadDriver() and UnloadDriver()
# and maybe adjust the VDRPRG and VDRCMD to your particular
# requirements.
#
# Since this script loads the DVB driver, it must be started
# as user 'root'. Add the option "-u username" to run VDR
# under the given user name.
#
# Any command line parameters will be passed on to the
# actual 'vdr' program.
#
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: runvdr 1.19 2006/05/14 16:02:05 kls Exp $

VDRPRG="./vdr"
VDRCMD="$VDRPRG -w 60 $*"

KILL="/usr/bin/killall -q -TERM"

# Detect whether the DVB driver is already loaded
# and return 0 if it *is* loaded, 1 if not:
function DriverLoaded()
{
  return 1
}

# Load all DVB driver modules needed for your hardware:
function LoadDriver()
{
}

# Unload all DVB driver modules loaded in LoadDriver():
function UnloadDriver()
{
}

# Load driver if it hasn't been loaded already:
if ! DriverLoaded; then
   LoadDriver
   fi

while (true) do
      eval "$VDRCMD"
      if test $? -eq 0 -o $? -eq 2; then exit; fi
      echo "`date` reloading DVB driver"
      $KILL $VDRPRG
      sleep 10
      UnloadDriver
      LoadDriver
      echo "`date` restarting VDR"
      done


Beispiel Funktionen, für den aktuellen DVB Treiber DVB Installation v4l-dvb.

function DriverLoaded()
{
    grep -qse dvb[-_]core /proc/modules
}

# Load all DVB driver modules needed for your hardware:
function LoadDriver()
{
    make -C "$SOURCEDIR/DVB/v4l" load
}

# Unload all DVB driver modules loaded in LoadDriver():
function UnloadDriver()
{
    make -C "$SOURCEDIR/DVB/v4l" unload
}

[Bearbeiten] Scripts / Tools

  1. watchvdr
  2. [1]
  3. runvdr von Linvdr
  4. runvideo-rc
  5. runvideo
  6. Daemon
  7. Perl
  8. für mehrere VDR Instanzen
  9. Errror
  10. runvdr-extreme