> I'd love to take a look at this script, and, more than likely, I'm not > the only one :) > > Please post an example. > >OK - This is a quick & dirty hack - I'm sure there are several more elegant solutions... But it works. NOTE: this is designed for a Shoutcast server. You'd need to change the check= lines to work with Icecast. Couldn't find an Icecast-specific copy, since I'm only using Shoutcast servers currently. 2 files: #!/bin/bash # Keepalive for liveice encoder # bill@radioparadise.com # LOG=/usr/local/icecast/ka.log SERVER=scastsrv2.shoutcast.com:8048 DIR=icecast STREAM=RP128 STARTFILE=/usr/local/icecast/restart.128 echo "`date` - Keepalive started for $STREAM" >> $LOG while [ 0 ] do check=`lynx -dump http://$SERVER/index.html | grep -c "currently down"` if [ $check = 1 ] then $STARTFILE echo "`date` - $STREAM restarted" >> $LOG sleep 10 check=`lynx -dump http://$SERVER/index.html | grep -c "currently down"` if [ $check = 1 ] then echo "`date` - Bummer. $STREAM on $SERVER is down" >> $LOG else echo "`date` - Yippee! $SERVER sez Stream Is Up!" >> $LOG fi # else # echo "`date` - $STREAM on $SERVER OK" >> $LOG fi sleep 20 done [sample $STARTFILE] #!/bin/bash DIR=icecast kill `/usr/local/icecast/ps xww | grep "$DIR/lame" | cut -c1-5` >/dev/null kill `/usr/local/icecast/ps xww | grep "$DIR/liveice" | cut -c1-5`>/dev/null/usr/local/$DIR/liveice >/dev/null 2>/dev/null &> > > Liveice definitely needs a keepalive script of some kind. It's tricky, > > though - since it can lose connection to the server & stop streaming,but> > continue to run. The only truly reliable keepalive I've used polls the > > server to see if it says the stream is up & if not kills & restartsliveice.> > When killing liveice, it's best to kill the lame process(es) that itspawns> > as well. I've seen it leave behind zombie lame processes that prevent > > liveice from starting up. > > -- > ------------------------------------ > Robin P. Blanchard > IT Program Specialist > Georgia Center for Continuing Ed. > fon: 706.542.2404 fax: 706.542.6546 > email: Robin_Blanchard@gactr.uga.edu > ------------------------------------ >--- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
I'd love to take a look at this script, and, more than likely, I'm not the only one :) Please post an example.> Liveice definitely needs a keepalive script of some kind. It's tricky, > though - since it can lose connection to the server & stop streaming, but > continue to run. The only truly reliable keepalive I've used polls the > server to see if it says the stream is up & if not kills & restarts liveice. > When killing liveice, it's best to kill the lame process(es) that it spawns > as well. I've seen it leave behind zombie lame processes that prevent > liveice from starting up.-- ------------------------------------ Robin P. Blanchard IT Program Specialist Georgia Center for Continuing Ed. fon: 706.542.2404 fax: 706.542.6546 email: Robin_Blanchard@gactr.uga.edu ------------------------------------ --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
ok...based on William's shoutcast-based suggestion, i've come up with the following. i haven't had time to really test the thing yet...suggestions are greatly appreciated. i based this on the fact that icecast's stats.log tells what sources are connected (in my case 0 and 1) and that log is updated frequently (per icecast.conf) #!/bin/sh DIR=/usr/local LOG=$DIR/var/icecast/log/stats.log SOURCE=`cat $LOG |grep Source\ [0-1] |awk '{print $1" "$2}'|sort |uniq` PIDS=`ps ax |grep $DIR/bin/liveice |awk '{print $1}' ; ps ax |grep $DIR/bin/lame |awk '{print $1}'` if [ "$SOURCE" ] ; then echo "LiveIce still connected to icecast server." else if [ "$PIDS" ] ; then echo "Killing rogue processes..." echo "pid(s): $PIDS" kill -9 $PIDS $DIR/bin/liveice -F $DIR/etc/liveice/liveice.cfg>/dev/null 2>/dev/null &echo "LiveIce restarted at `date`." else $DIR/bin/liveice -F $DIR/etc/liveice/liveice.cfg >/dev/null 2>/dev/null & echo "LiveIce restarted at `date`." fi fi -- ------------------------------------ Robin P. Blanchard IT Program Specialist Georgia Center for Continuing Ed. fon: 706.542.2404 fax: 706.542.6546 email: Robin_Blanchard@gactr.uga.edu ------------------------------------ --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.