Runvdr

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K (Hob den Schutz von „Runvdr“ auf)
 
(84 dazwischenliegende Versionen von 61 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
Andere Scripts:
+
==Beschreibung==
 +
{{Box Datei | [[Struktur|$SOURCEDIR]]/VDR/runvdr |
 +
<pre>
 +
#!/bin/sh
  
http://www.informatik.uni-bremen.de/cgi-bin/cgiwrap/mwiesner/download/watchvdr
+
# 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 $
  
ftp://ftp.berlios.de/pub/avm-capi4linux/temp/cooker/dvb
+
VDRPRG="./vdr"
 +
VDRCMD="$VDRPRG -w 60 $*"
  
 +
KILL="/usr/bin/killall -q -TERM"
  
http://linvdr.org/download/doku/vdr-2/runvdr
+
# 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()
 +
{
 +
}
  
  #!/bin/sh
+
# Unload all DVB driver modules loaded in LoadDriver():
  #
+
function UnloadDriver()
  # 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 $
+
  
  export TERM=linux
+
# Load driver if it hasn't been loaded already:
  export LANG=POSIX
+
if ! DriverLoaded; then
  export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/src/vdradmind
+
  LoadDriver
 +
  fi
  
  DESC="Digital Videorecorder"
+
while (true) do
  CONF="/usr/local/src/VDRtmp/[[vdr.conf]]"
+
      eval "$VDRCMD"
 
+
      if test $? -eq 0 -o $? -eq 2; then exit; fi
  . "${CONF}"
+
       echo "`date` reloading DVB driver"
 
+
       $KILL $VDRPRG
  VERSION=( `grep -s 'define VDRVERSION' $MYPATH/VDR/config.h` )
+
      sleep 10
  COLUMNS=( `stty size 2>/dev/null` )
+
      UnloadDriver
 
+
      LoadDriver
  VDRPRG="${MYPATH}/VDR/vdr"
+
       echo "`date` restarting VDR"
  test -x "${VDRPRG}" || exit 0
+
 
+
  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 -eo%c|grep -wc ^${1}` -eq 0
+
  }
+
 
+
  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
 
       done
  }
+
</pre>
 
+
}}
  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 1 2 3 ; do
+
              f=${f}". "
+
              echo -ne "Shutting down DVB: ${f}\r"
+
              sleep 1s
+
          done
+
          ## way 1:
+
          cd ${MYPATH}/DVB/driver ; make rmmod
+
          ## way 2:
+
          #modules -rq
+
          ## way 3:
+
          #/etc/init.d/dvb stop
+
          ## way 4:
+
          #cd ${MYPATH}/DVB/build-<KERNELVERSION> ; ./insmod.sh unload
+
      }
+
  }
+
 
+
  start_dvb() {
+
      echo ${START_PROCS}|egrep -q dvb && {
+
          echo "Starting DVB: "
+
        ## way 1:
+
        cd ${MYPATH}/DVB/driver ; make insmod
+
        ## way 2:
+
        #modules -q
+
        ## way 3:
+
        #/etc/init.d/dvb start
+
        ## way 4:
+
        #cd /usr/local/src/DVB/build-<KERNELVERSION> ; ./insmod.sh load
+
      }
+
  }
+
 
+
  modules() {
+
      case "${1##*\-}" in
+
          q) REV="${LMODULES}" ;;
+
          *) REV="${RMODULES}" ;;
+
      esac
+
 
+
      echo "${REV}"|sed -e '/^[ ]*$/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 10; vdradmind.pl; } &
+
  }
+
 
+
  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
+
Beispiel Funktionen, für den aktuellen DVB Treiber [[DVB Installation v4l-dvb]].
    start)
+
        for cmd in conf cmds ${START_PROCS} ; do
+
            load_${cmd}
+
            test ${cmd} = evexec && {
+
                RELOAD_EVEXEC="yes"
+
            }
+
        done
+
  
        while (true) ; do
+
function DriverLoaded()
            test -e "${SYSLOG}" -a -e "${VDR_CONFIG}/[[setup.conf]]" && {
+
{
                CHAN=$(tail -n 300 ${SYSLOG}|sed "/${PHRASE}/!d;s#^.* ##"|sed '$!d')
+
    grep -qse dvb[-_]core /proc/modules
                test -n "${CHAN##*[^0-9,-]*}" && {
+
}
                    sed -i "s/^CurrentChannel.*/CurrentChannel = ${CHAN}/" "${VDR_CONFIG}/[[setup.conf]]"
+
                }
+
# Load all DVB driver modules needed for your hardware:
            }
+
function LoadDriver()
 
+
{
            test -f "${VDR_CONFIG}/loadkeys/${AV7110LOADKEYS}" \
+
    make -C "[[Struktur|$SOURCEDIR]]/DVB/v4l" load
                -a "`which av7110_loadkeys`" -a \
+
}
                -w /proc/av7110_ir && {
+
                    av7110_loadkeys "${VDR_CONFIG}/loadkeys/${AV7110LOADKEYS}" > /proc/av7110_ir
+
# Unload all DVB driver modules loaded in LoadDriver():
            }
+
function UnloadDriver()
 +
{
 +
    make -C "[[Struktur|$SOURCEDIR]]/DVB/v4l" unload
 +
}
  
            test -x "${VDR_LIB}/libvdr-pluginsetup.so.${VERSION[2]//\"}" && {
+
==Scripts / Tools==
                PSETUP="-P'pluginsetup'"
+
# [http://www.informatik.uni-bremen.de/cgi-bin/cgiwrap/mwiesner/download/watchvdr watchvdr]
            }
+
# [ftp://ftp.berlios.de/pub/avm-capi4linux/temp/cooker/dvb]
 +
# [http://linvdr.org/download/doku/vdr-2/runvdr runvdr von Linvdr]
 +
# [http://www.tja.org/dvb/runvideo-rc runvideo-rc]
 +
# [http://www.tja.org/dvb/runvideo runvideo]
 +
# [http://sites.inka.de/~bigred/sw/vdr.html Daemon]
 +
# [http://www.leo.org/~loescher/tipsdata/runvdr Perl]
 +
# [ftp://ftp.heise.de/pub/ct/listings/0308-202.zip für mehrere VDR Instanzen]
 +
# [http://www.errror.org/vdr Errror]
 +
# [http://www.udo-richter.de/vdr/scripts.en.html runvdr-extreme]
  
            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
+
            }
+
            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