AW: [vdr] execute command after vdr starts

Udo Richter udo_richter at gmx.de
Fri Sep 8 02:50:09 CEST 2006


C.Y.M wrote:
> Yes, I like the idea of backgrounding VDR using "&" and then using 'wait $PID'.
>  Is that the method you use?  I've been trying to find the best way to do this.
>  Could you give me an example? :)

Something like that. This is a snippet of my overgrown runvdr script:

   # Run VDR
   eval "$VDRCMD &"

   # Remember PID of VDR process
   PID=$!

   # Wait for VDR to end or signal to arrive
   wait $PID

   # Remember return value of VDR
   RET=$?

The reason I do it this way is that I also handle some signals sent to 
runvdr, to terminate or restart on demand.
If you want to start something in parallel, its probably no big 
difference whether you start your script before or after VDR, as long as 
you background it. You can background within a script like this:

   {
     sleep 1s
     echo -n world
   } &
   echo -n "hello "
   sleep 2s
   echo .

> For now, I'm just trying to send a MESG via svdrpsend.pl to VDR so it displays a
> welcome message after starting up and initializing its plugins.  

You can wait for the SVDRP socket to accept connections, that would be 
one way to wait for a mainly running VDR.

Cheers,

Udo



More information about the vdr mailing list