#!/bin/sh # # run vdr rm -f /tmp/vdr_stop /tmp/vdr_quick_restart case "$1" in -k) touch /tmp/vdr_stop killproc "/usr/bin/vdr" 10 exit $? ;; -r) killproc "/usr/bin/vdr" 10 exit $? ;; -q) touch /tmp/vdr_quick_restart killproc "/usr/bin/vdr" 0 exit $? ;; -n) norestart=1 ;; -*) echo "Usage $0 {-k | -r | -q}" echo " -k kill vdr" echo " -r restart vdr" echo " -q quick restart vdr" echo " -n no restart if an error occur" exit 1 ;; esac echo $$ > /var/run/runvdr.pid while (true) do . /etc/rc.config export LANG export LC_ALL=$LANG export VDR_CHARSET_OVERRIDE /etc/vdr/run.d/rc.action start if [ -e /etc/vdr/setup.conf.add ]; then cat /etc/vdr/setup.conf.add >> /etc/vdr/setup.conf rm /etc/vdr/setup.conf.add fi if [ -n "$VDR_CHANNELLIST" ]; then ln -fs /etc/vdr/channels/$VDR_CHANNELLIST.conf /etc/vdr/channels.conf fi if ps | grep -v "grep" | grep -q "lircd" && (! test -e /usr/bin/vdr-sxfe || ! grep -sqi "^lirc\." /etc/vdr/remote.conf); then VDR_ARGS="$VDR_ARGS --lirc" elif ls /etc/vdr/remote.rc* >/dev/null 2>&1 && [ -e /usr/bin/av7110_loadkeys ]; then VDR_ARGS="$VDR_ARGS --rcu" fi # suche Plugins und Parameter zusammen plugins="" for plugin in $VDR_PLUGIN_ORDER `ls /usr/lib/vdr/libvdr* 2>/dev/null | sed 's/.*libvdr-\([^.]*\).*/\1/'`; do if [ -z "`echo "$plugins" | grep -e "-P[^a-z]$plugin " 2>/dev/null`" -a -n "`ls /usr/lib/vdr/libvdr-$plugin* 2>/dev/null`" ]; then eval options=\$VDR_PLUGIN_ARGS_$plugin plugins="$plugins -P\"$plugin $options\"" fi done starttime=`date +%s` # starte vdr eval /usr/bin/vdr -s /etc/vdr/shutdown.d/rc.action -r /etc/vdr/recording.d/rc.action -w 60 -L /usr/lib/vdr -c /etc/vdr -v /data/tv/tv0 -g /tmp -u root $VDR_ARGS $plugins >>${VDR_STDOUT-/dev/stderr} test -e /tmp/vdr_stop && break if [ -e /tmp/vdr_quick_restart ]; then rm -f /tmp/vdr_quick_restart /etc/vdr/run.d/rc.action quick_restart else echo -n "VDR exits at "; date killproc "/usr/bin/vdr" 0 test -e /tmp/vdr_stop -o "$norestart" = "1" && break # schnelle wiederholte Neustarts verzögern if [ $starttime -gt $(( `date +%s` - 15 )) ]; then sleep 10 # waiting for vdr fi /etc/vdr/run.d/rc.action restart fi done rm -f /var/run/runvdr.pid /tmp/vdr_stop /tmp/vdr_quick_restart /etc/vdr/run.d/rc.action stop