[icecast] Keeping Icecast and Liveice running...
William Goldsmith
wildbill at kpig.com
Tue Oct 9 16:23:40 UTC 2001
> 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 at 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 & 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 at 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 at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Icecast
mailing list