Request - an additional exit code

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

 



Patrick Gleichmann wrote:
> At the moment I have a script, which sends a kill signal to leave the 
> endless loop = end vdr.
> The problem is that in runvdr I simply can't decide whether a normal 
> shutdown through my script happened or some other signal, e.g. watchdog, 
> kicked in, since all signals return "0".

I'm going a different way: I've implemented signal handling in my runvdr 
itself. That way I can kill runvdr, and runvdr will kill vdr, and of 
course knows that vdr doesn't need to be restarted.

Simplified, it works like this:

   SIG=
   trap "SIG=TERM" SIGTERM

   # run vdr
   eval "$VDRCMD" &
   VDRPID=$!

   # wait for VDR terminating or signal caught
   wait $VDRPID
   VDRRETURN=$?

   if [ "$SIG" = "TERM" ] ; then
     # runvdr was killed
     kill $VDRPID
     # dont restart
   else
     # normal termination, decide on errorlevel $VDRRETURN
   fi

Cheers,

Udo


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux