[mythtv-users] wait in mythbackend init script

Keith Pyle kpyle at austin.rr.com
Sat Jan 5 16:12:05 UTC 2013


Arun Khan wrote:
> On Sat, Jan 5, 2013 at 6:32 AM, Josu Lazkano<josu.lazkano at gmail.com>  wrote:
>
>> >I have a little problem with mythbackend init script in Debian MythTV system.
>> >
>> >Before start mythbackend on the boot time, I need to be sure that the
>> >DVB adapters are created correctly.
>> >
>> >How could I check that all my DVB adapters are created? Anyone has
>> >experience with the boot time init script
>> >(/etc/init.d/mythtv-backend)?
>> >
> I suppose you could write a script that tests for the DVB adapters,
> return success (return code=0) or error (return code > 0 ).
> Invoke this script and depending on the return value continue with the
> execution of the mythbackend script.
>

I did this for my backend.  For a Gentoo init script, it looks like this:

     <removed some stuff in the "start()" section of 
/etc/init.d/mythbackend>

         ebegin "Loading modules for video capture cards"
         /sbin/modprobe saa7164
         rc=$?
         if test $rc -eq 0 -a ! -e /dev/dvb ; then
                 eerror "/dev/dvb not created"
                 rc=1
         fi
         eend $rc
         test $rc -ne 0 && return $rc

         ebegin "Starting MythTV Backend"

     <rest of /etc/init.d/mythbackend removed>

This attempts to load the module for the HVR-2250, and checks the return 
code from the module load.  If the modprobe succeeded (rc=0), then it 
checks that the /dev/dvb device tree exists.  If either the modprobe 
failed or the /dev/dvb entries don't exist, rc will be non-zero, and the 
"return" will execute and stop the mythbackend init script.  Otherwise, 
it continues to the section starting mythbackend.

You could of course add a sleep command if you need to wait for 
something to initialize.

Note that different distributions have different init script 
capabilities.  You may have to slightly adapt this to work with Debian.

Keith



More information about the mythtv-users mailing list