[mythtv-users] Wait for DVB devices

Mark Lord mythtv at rtr.ca
Mon Oct 24 16:33:40 UTC 2011


On 11-10-24 03:34 AM, Josu Lazkano wrote:
..
> 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
> 	;;
..

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

Right after the "else" line shown above.
Perhaps use a loop like this one:

    ## wait 30secs max for all four dvb tuners to show up:
    waiting=30
    while [ $waiting -gt 0 ]; do
        sleep 1
        waiting=$((waiting - 1))
        all=yes
        for dvb in 0 1 2 3 ; do
            [ -e /dev/dvb/adapter$dvb/frontend$dvb ] || all=no
        done
        [ "$all" = "yes" ] && waiting=0
    done

Cheers


More information about the mythtv-users mailing list