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

  • From: Hungerburg <pch13@xxxxxxxxx>
  • To: darkice@xxxxxxxxxxxxx
  • Date: Sat, 14 Jan 2012 23:02:11 +0100

On Sat, Jan 14, 2012 at 08:21:40PM +0100, JoergSorge wrote:
> Am 14.01.2012 18:08, schrieb Hungerburg:
> >> Mostly once at a Day, I got an Error (from darkice) like "Failed to
> >> write to ring buffer". I mean, that occurs when darkice reconnect due
> >> the disconnect by the IP-Provider.
> > I remember the message. Here it appeared when the uplink was congested,
> > I suppose. I switched to using edcast-jack then. But it would not mean,
> > that darkice stopped, just that it did omit some signal and send some
> > garbage much later.
> right, darkice ist runnig and sendig noise...

Here it wasn't noise, but the previously dropped subsecond pieces several in 
one shove. Sometimes that was even funny, but more often not...

> so, it's not possible to use the restart-function.
> I hoped, it can be possible to catch this message and stop darkice.

Is the restart different from stop/start cycle?

> > Your best bet may be to use qjackctl: I use it myself to start jack the
> > server and some jack clients, eg. timemachine, jamin, jackrack. It does
> > so by calling to scripts too, but there might be end-user documentation
> > available. Its patchbay helps tremendously with plumbing :)
> I also use qjackctl and have try to start meterbidge through an entry in
> the qjackctl-Options after starting. But after this qjackctl freezes.
> Then I gave up to use this.

Attached "startjackclients.sh" that works very nice, there are even meterbridge 
commands there. I now use the meters inside of timemachine, that is useful to 
dump a high quality recording anyways. Maybe you did not background all 

Thinking about the trigger that you need: "$ darkice 2> error.txt" will send 
the message to said file. You could do an "$ inotifywait error.txt" in another 
terminal, and it will return, as soon as something is written.

An alternate take, a very minimal shell script below: Instead of darkice it 
spawns a ping. Standard and error output are piped to grep. As soon as the 
message in quotes is received, grep will quit and take down the ping with it. 
Now run the script and pull the networking cable, watch the terminal, plug the 
cable in again.

while (true) ; do
        echo Start
        ping some.net 2>&1 | tee out.txt | grep -q "Network is unreachable"
        tail out.txt
        sleep 2

Of course you will not see any darkice messages on the console. But they are 
saved in "out.txt". If your ping sends a german message instead, just change 
the string above. Try with darkice instead of ping... If the pipelines do not 
buffer too much, it might even work.


Other related posts: