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

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

On Sat, Jan 14, 2012 at 11:02:11PM +0100, Hungerburg wrote:
> 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.

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.

-- 
peter

Other related posts: