Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: MP3 Patch and VDR/Driver shutdown ?



Stefan Huelswitt wrote:
...
> You don't have to reboot. In the case of the fault, the mpg123
> process is still running after VDR has exited (and mpg123 has
> inherit some filehandles from VDR). This is why you can't unload
> the driver. Do a
> 
> ps -ax | grep mpg123
> 
> and kill the left behind task. Now you can unload the driver.

As a more general solution, I am using a modified runvdr
script, which kills everything that is using any /dev/ost/*
device. 

While the script itself is tailored to my personal needs,
some parts of it may be useful for all of us, so here it is:

-----------vvv--------------- please cut here -----------vvv---------------
#!/bin/sh

DRIVERDIR=/home/cko/DVB/driver
VDRDIR=/home/cko/VDR
VDRUSER=cko
TOOLDIR=/home/cko/bin
VDRCMD="./vdr -c . -a $TOOLDIR/play_ac3 -w 15 -s $TOOLDIR/killvdr"
LOG=/var/log/update_timers_log
INTERVAL=480

/usr/local/sbin/lircd

while (true) do
   if fuser /dev/ost/* > /dev/null ; then
      kill `fuser /dev/ost/* | cut -d: -f2- | sed 's@^ *@@g' | sort -u`
      sleep 2
      if fuser /dev/ost/* > /dev/null ; then
         kill -KILL `fuser /dev/ost/* | cut -d: -f2- | sed 's@^ *@@g' | sort -u`
      fi
   fi
   
   cd $DRIVERDIR
   make rmmod
   make insmod
   
   chmod +r /var/log/messages
   
   /usr/local/bin/rdate waldi

   if [ "`find $LOG -mmin -$INTERVAL`" != $LOG ] ; then
      date >> $LOG
      $TOOLDIR/update_timers.old >> $LOG
      echo >> $LOG
   fi

   cd $VDRDIR
   su -c "$VDRCMD" $VDRUSER
done
-----------^^^--------------- please cut here -----------^^^---------------



The $TOOLDIR/killvdr script is a one-liner:

-----------vvv--------------- please cut here -----------vvv---------------
#!/bin/sh

killproc /home/cko/VDR/vdr
-----------^^^--------------- please cut here -----------^^^---------------



and $TOOLDIR/play_ac3 is also trivial:

-----------vvv--------------- please cut here -----------vvv---------------
#!/bin/sh
echo "play_ac3: start ac3dec " `date`
ac3dec -C
echo "play_ac3: done at " `date`
-----------^^^--------------- please cut here -----------^^^---------------



Home | Main Index | Thread Index