[mythtv-users] Wait for DVB devices

Josu Lazkano josu.lazkano at gmail.com
Mon Oct 24 07:34:05 UTC 2011


2011/10/24 Mark Lord <mythtv at rtr.ca>:
> On 11-10-23 08:46 PM, Josu Lazkano wrote:
>>..
>> Hello, I notice that I have not installed the upstart, I try to
>> install it but if I install upstart I must uninstall sysvinit, and I
>> think this is not a good idea.
>>
>> Is possible to add the adapters check before mythbackend starts with sysvinit?
>
> Absolutely.  Way better than upstart, too.
>
> Eg. you could do this (below), or even something more sophisticated,
> from the /etc/init.d/mythtv-backend script:
>
>    while [ ! -e /dev/dvb/adapter0/frontend0 ] ; do
>       sleep 0.5
>    done
>
> On my own system, I have a rather more complex script to wait for multiple DVB/V4L
> devices to become fully present, and the script then creates unique symlinks for
> each of them so I don't have to rely on particular cards being assigned particular
> numbers by the kernel.
>
> Cheers
>
>
>

Thanks Mark, this is my init script:

# cat /etc/init.d/mythtv-backend
#! /bin/sh
### BEGIN INIT INFO
# Provides:          mythtv-backend
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      mysql
# Should-Stop:       mysql
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/Stop the MythTV server.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mythbackend
NAME="mythbackend"
DESC="MythTV server"

test -x $DAEMON || exit 0

set -e

USER=mythtv
RUNDIR=/var/run/mythtv
ARGS="--daemon --logfile /var/log/mythtv/mythbackend.log --pidfile
$RUNDIR/$NAME.pid"
EXTRA_ARGS=""
NICE=0

if [ -f /etc/default/mythtv-backend ]; then
  . /etc/default/mythtv-backend
fi

ARGS="$ARGS $EXTRA_ARGS"

mkdir -p $RUNDIR
chown -R $USER $RUNDIR

unset DISPLAY
unset SESSION_MANAGER

case "$1" in
  start)
	if test -e $RUNDIR/$NAME.pid ; then
		echo "mythbackend already running, use restart instead."
	else
		echo -n "Starting $DESC: $NAME "
		start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
			--chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
		echo "."
	fi
	;;
  stop)
	echo -n "Stopping $DESC: $NAME "
	start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
		--chuid $USER --exec $DAEMON -- $ARGS
	test -e $RUNDIR/$NAME.pid && rm $RUNDIR/$NAME.pid
	echo "."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: $NAME "
	start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --exec $DAEMON -- $ARGS
	echo "."
	sleep 3
	start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
	echo "."
	;;
  reload)
  	start-stop-daemon --stop --oknodo --signal HUP --pidfile \
  	$RUNDIR/$NAME.pid --chuid $USER --exec $DAEMON -- $ARGS
  	echo "."
  	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0

I am using 4 DVB adapters, where I must put the "while"?

Thanks for your help, best regards.
-- 
Josu Lazkano


More information about the mythtv-users mailing list