Am Samstag, 14. Januar 2012, 23:27:58 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 Yes, but i've used some ping check script like this in the past and still got not any possible network problem solved with it. So i wrote a small script which checks against a remote (or even local) icecast streaming server serving the darkice stream if it is up and running there: /root/sbin/darkice_restart_if_down.sh --- snip --- #!/bin/sh ######################################## ## Darkice Watchdog ## watch darkice live stream on icecast ## Niels Dettenbach <nd@xxxxxxxxxxxx> ## (c) 2009 GPL ## v0.2 ######################################## # icecast status URL URL='http://stream.server.tld:8000/status.xsl' TEXTTOSEARCH='meinradio.mp3' TIMEOUT=10 DATE=$(date) LOGFILE=/var/log/darkice_watchdog CUR=$(curl --connect-timeout ${TIMEOUT} --max-time ${TIMEOUT} -3 --silent ${URL}) TEST=$(echo $CUR | grep ${TEXTTOSEARCH}) # If not zero, server is OK if [[ ! $TEST == "" ]]; then echo $DATE "- stream is OK" >> $LOGFILE; else echo $DATE "- stream down - restart" >> $LOGFILE; #restart darkice /etc/init.d/darkice restart fi --- snap --- The only thing this script did not catch is a silence on the stream (but this could be added by the jack silence detection extension if required. ...and within the crontab something like: --- schnipp --- ## Darkice watchdog */5 * * * * root /root/sbin/darkice_restart_if_down.sh > /dev/null --- schnapp --- But even in a very few scenarios (i.e. with ALSA) a simple darkice restart did not brought back the full stream incl. content - the script has to wait some seconds before darkice could get restarted properly and/or other things has to do in between. So i changed the restart script into something like this a little bit ugly hack: --- snip --- #!/bin/sh ########################################### ## Darkice auto/hard Restarter ## Niels Dettenbach <nd@xxxxxxxxxxxx> ## (c) 2009 - GPL ########################################### /usr/bin/killall darkice /bin/sleep 20 # ...do other clean down stuff /etc/init.d/darkice stop sleep 7; # ... do other pre stream init stuff /etc/init.d/darkice start --- snap --- but did not know today why if did this (;). cheers, Niels. -- --- Niels Dettenbach Syndicat IT&Internet http://www.syndicat.com/