]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - config/vdr/bin/runvdr
Fix runvdr skript that detects vdradmin as already running vdr
[people/pmueller/ipfire-2.x.git] / config / vdr / bin / runvdr
CommitLineData
42d62a83
AF
1#!/bin/sh
2
3# runvdr: Loads the DVB driver and runs VDR
4#
5# If VDR exits abnormally, the driver will be reloaded
6# and VDR restarted.
7#
8# Any command line parameters will be passed on to the
9# actual 'vdr' program.
10#
11
2adf5286
AF
12PLUGOPTS="-Pstreamdev-server"
13
42d62a83 14VDRPRG="./bin/vdr"
0e07ae54 15VDRCMD="/bin/nice --11 $VDRPRG -w 60 -c /opt/vdr/etc $PLUGOPTS $*"
42d62a83
AF
16
17KILL="killall -q -TERM"
18
38fd5aa3 19if [ "$(ps -A | grep " vdr$")" != "" ]; then
2a8c4fcb 20 echo Error! VDR is already running!
2adf5286
AF
21 exit 1
22fi
23
42d62a83
AF
24mkdir -p /var/video
25cd /opt/vdr
26while (true) do
27#
28# If you have stability Problems at tuning or similar
29# unload and reload the dvb-modules here ...
30# Example is for Hauppauge Nexus 2.0
31#
32# rmmod dvb_ttpci
33# rmmod stv0299
34# rmmod dvb_core
35# modprobe dvb_ttpci
0f4001f8
AF
36# sleep 5
37#
38# Check if DVB device is present / remove this check if you
39# would use vdr as streaming client only
40#
41 if [ ! -e /dev/dvb/adapter0/frontend0 ]; then
42 echo No DVB tuner found!
43 exit 1
44 fi
45#
46# Run VDR
42d62a83 47#
42d62a83
AF
48 eval "$VDRCMD"
49 if test $? -eq 0 -o $? -eq 2; then exit; fi
50 $KILL $VDRPRG
51 sleep 10
52 echo "`date` restarting VDR"
53done