eb69484d5380afad6d780c9597e4f79313ba0c8b
[people/pmueller/ipfire-2.x.git] / config / vdr / bin / runvdr
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
12 PLUGOPTS="-Pstreamdev-server"
13
14 VDRPRG="./bin/vdr"
15 VDRCMD="/bin/nice --11 $VDRPRG -w 60 -c /opt/vdr/etc $PLUGOPTS $*"
16
17 KILL="killall -q -TERM"
18
19 if [ "$(ps -A | grep " vdr")" != "" ]; then
20 echo Error! VDR is already running!
21 exit 1
22 fi
23
24 mkdir -p /var/video
25 cd /opt/vdr
26 while (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
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
47 #
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"
53 done