[darkice] Re: watch darkice errors and restart if necessarily

  • From: JoergSorge <joergsorge@xxxxxxxxx>
  • To: darkice@xxxxxxxxxxxxx
  • Date: Sun, 15 Jan 2012 16:50:08 +0100

Am 14.01.2012 23:27, schrieb Hungerburg:

> Script can be cleaner, like that:
> 
> #!/bin/sh
> while (true) ; do
>       echo Start
>       ping some.net 3>&1 1>&2 2>&3 | grep -q "Network is unreachable"
>       sleep 2
> done
> 
> Swap stdout and stderr: see all of stdout in the console, parse stderr.
> 
> Promised attachment this time.

Hi, I've found the error now in the darkice.log
So, I've try the following and it works.

if grep "failed to write to ring" stream-xy.log
        then
                echo "Fehler gefunden, stoppe darkice-xy"
                ./srb-stream-xy.sh stop
                echo "stream-xy starten.."
                sleep 5
                ./srb-stream-xy.sh start
        fi      

But is it possible, to check in wich row of the logfile the match was
found, or the like?
Then, I can the code wrap in a while loop...

Regards,
Jörg






Other related posts: