[Icecast] Daemontools and icecast / ices2

Klaas Jan Wierenga k.j.wierenga at home.nl
Fri Jul 7 07:06:15 UTC 2006


Hi Rob,

I am using daemontools to keep icecast in the air.
I think your script should work just fine. Is there anything in the 
error.log? Does icecast work when you start it from the command line?
One issue I've found is that when a previous instance has crashed but 
some of the ports on which it listens have not been released yet because 
of a high load on the machine, then the new instance may not be able to 
starting listening on those ports. That's why in my daemontools 'run' 
script I use a loop around 'nc' (or netcat) to check that the previous 
icecast instance is no longer listening on it's ports. A simple solution 
would be to just sleep for a couple of seconds, but I was interested in 
restarting icecast as fast as possible.

Regards,
KJ

p.s. Below is my run script, I also set some ulimits to get core dumps 
if icecast crashes (ulimit -c) and to be able to open more than the 
default 1024 connections (ulimit -n). Messages sent with /usr/bin/logger 
end up in /var/log/messages.

#!/bin/sh

#
# log some info
#
[ -x /usr/bin/logger ] && /usr/bin/logger "starting icecast ... "

#
# set appropriate ulimits
#
ulimit -c unlimited
ulimit -n 32768
if [ -x /usr/bin/logger ]; then
        ulimit -a | /usr/bin/logger
fi

#
# wait for previous instance to stop
# it has stopped when we can no longer connect to 127.0.0.1:8000
# $? == 0 means we can still connect to old instance
#
if [ -x /usr/bin/nc ]; then
  /usr/bin/nc -z 127.0.0.1 8000
  while [ $? -eq 0 ]; do
    sleep 1
    logger "still waiting for icecast to finish ..."
    /usr/bin/nc -z 127.0.0.1 8000
  done
fi

#
# start icecast
#
exec /opt/icecast/bin/icecast -c /opt/icecast/etc/icecast.xml



Rob McDonald schreef:
>
>  
>
>  
>
> Hi all,
>
>  
>
> I'm trying to use daemontools to manage the icecast server.
>
>  
>
> I've got it installed and working (with qmail)
>
>  
>
> However it wont work with icecast.
>
>  
>
> My run file has the contents:
>
> -------------------------------
>
> #!/bin/sh
>
>  
>
> exec setuidgid icecast /usr/local/bin/icecast -c 
> /usr/local/etc/icecast.xml
>
> ------------------------
>
> I have also tried it using icecasts built in user switching abilities, 
> but makes no difference.
>
>  
>
> What is happening is that daemontools is trying to start it and 
> failing, and as it should be, trying again in and endless loop.
>
>  
>
> Has anyone done this before? Or possibly know why it cannot be done?
>
>  
>
>  
>
> Cheers
>
>  
>
> Rob
>
>  
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Icecast mailing list
> Icecast at xiph.org
> http://lists.xiph.org/mailman/listinfo/icecast
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.9.9/382 - Release Date: 4-7-2006
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/icecast/attachments/20060707/3895695b/attachment.htm>


More information about the Icecast mailing list