Mailing List archive

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

[vdr] Re: driver reload via commands.conf



Hi


I have tested the following scripts with H+ Remote using lircd and
irexec.

Quit is shutting down VDR and the computer (soon it will program RTC
Alarm).

PROG is toggling vdr + DVB up/down.


feel free to improve this first trial ; the point is i could manage to
shutdown vdr inside the shutdown script (the one passed with -s option).
As lirc should be used i found easier using irexec.


Hope this helps.

Patrick.

-------------- startvdr.sh (used by irexec)
#!/bin/bash
#
# Should we really need to shutdown vdr
if [ "`pidof vdr`" != "" ] ; then
 exit
fi
#
# to prevent from calling shutdown/starting scripts twice
#
# shutdown is running
#
if [ -f /tmp/shutvdr ]  ; then
 exit
fi
# startup is running 
#
if [ -f /tmp/startupvdr ]  ; then
 exit
fi
#
touch /tmp/startupvdr
echo "Starting VDR ..."
cd /home/dvb/DVB/driver
rmmod dvb
make insmod
sleep 30
#
/home/dvb/VDR/vdr -d -v /video -s /home/dvb/bin/shutall.sh
#
echo "Startup complete"
rm -f /tmp/startupvdr



----- Shutdvdr.sh (called by irexec)
#/bin/bash
#
# to prevent from calling shutdown/starting scripts twice
#
# startup is running
#
if [ -f /tmp/startupvdr ]  ; then
 exit
fi
#
# shutdown is running
#
if [ -f /tmp/shutvdr ]  ; then
 exit
fi
#
touch /tmp/shutvdr
echo "Shutdown of VDR .."
#
# we just need killing the first vdr process
#
pid=`pidof vdr | awk '{print $(NF)}'`
if [ "$pid" != "" ] ; then
 echo "Killing process $pid ..."
 kill -15 $pid
 kill -9  $pid
fi
sleep 5
cd /home/dvb/DVB/driver
make rmmod
echo "Shutdown complete"
#
rm -f /tmp/shutvdr



--------Shutall.sh (shutdown vdr then poweroff computer ) --------- 

#/bin/bash
echo "Shuttting down VDR .."
#
pid=`pidof vdr | awk '{print $(NF)}'`
if [ "$pid" != "" ] ; then
 echo "Killing process $pid ..."
 kill -15 $pid
 kill -9 $pid
fi
cd /home/dvb/DVB/driver
make rmmod
#
# setRTCAlarm DAY-hh:mm:ss
#
poweroff


--- example for lircrc configuration file 
--- vdr is startup on linux startup ; then the first script to call is
shutdown
--- 
begin
   prog    = irexec
   remote  = REALMAGIC
   button  = PRG
   repeat  = 0
   config  = /home/dvb/bin/shutvdr.sh
   config  = /home/dvb/bin/startvdr.sh
end



--  vdr start/shutdown at linux startup

#!/bin/sh
#
# dvb:        This is an init script for RedHat distribution.
#
# Author:      Patrick Gueneau (pgueneau@wanadoo.fr)
#
# description: this scripts automates dvb and vdr startup/shutdown
#              for more information on DVB and VDR check
http://ww.linuxtv.org
#
# Source function library.
. /etc/rc.d/init.d/functions

[ -d /home/dvb/DVB ] || exit 0
[ -d /home/dvb/VDR ] || exit 0
[ -d /home/dvb/bin ] || exit 0

PATH=/home/dvb/bin:/usr/local/sbin:/usr/local/bin:$PATH

# See how we were called.
case "$1" in
  start)
        echo -n "Starting VDR  "
        echo
        /usr/local/bin/irexec -d /home/dvb/lirc_config_vdr
        /home/dvb/bin/startvdr.sh
        touch /var/lock/subsys/vdr
        ;;
  stop)
        echo -n "Shutting down VDR "
        /home/dvb/bin/shutvdr.sh
        echo
        rm -f /var/lock/subsys/lirc
        ;;
  status)
        status vdr
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: lirc {start|stop|status|restart}"
        exit 1
esac

exit 0


==============================================

Jochen Vieten wrote:
> 
> hi all,
> 
> since the cam support (at least after replay) with the 0.9.x DVB drivers is
> broken i've tried
> to make a script for automatic restart of the dvb-drivers - with no success.
> 
> Any tips/suggestions?
> 
> My commands.conf:
> 1 Restart driver : /usr/local/bin/restartvdr
> 
> My script:
> 
> #!/bin/sh
> killall runvdr
> killall vdr
> sleep 5
> cd /usr/local/src/DVB/driver
> make reload
> sleep 10
> /usr/local/src/VDR/runvdr
> 
> Thanks and best regards,
> 
> Jochen



Home | Main Index | Thread Index