[Icecast] Starting Icecast as a service on CentOS

W2LIE w2lie at w2lie.net
Fri Oct 8 04:40:14 UTC 2010


On Thu, 07 Oct 2010 13:36:06 -0400, John List <johnlist at gulfbridge.net>
wrote:
> 
> What happens when you run the init script from the command line as root?
> 
> What happens when you launch the init script with the service command?:
> 
>     service icecast status
>     service icecast start
>     service icecast restart
> 
> 
> If that works, then you simply need to enable it under system V.
> 
> (I'm currently running Icecast just fine under RHES5.)
> 
> john

John and all who replied -
Thanks for the help.  I've been a bit tied up the last few nights, so I
wanted to thank you for helping me.

Running service icecast start does not work for me.  Here is the error:

[/etc/rc.d]# cd init.d
[/etc/rc.d/init.d]# service icecast2 status
Usage: /etc/init.d/icecast2 {start|stop|restart|reload|force-reload}
[/etc/rc.d/init.d]# service icecast2 start
Starting icecast2: /etc/init.d/icecast2: line 40: start-stop-daemon:
command not found
[/etc/rc.d/init.d]#

Running icecast2 from the command line as  ./icecast works fine.  I just
can't run it as a service..



This is the code I found.  I think it came with the Icecast package when I
unzipped the file.
This is located in my /etc/rc.d/init.d folder.


#! /bin/sh
#
# icecast2
#
#                Written by Miquel van Smoorenburg <miquels at cistron.nl>.
#                Modified for Debian
#                by Ian Murdock <imurdock at gnu.ai.mit.edu>.
#
#                Further modified by Keegan Quinn <ice at thebasement.org>
#                for use with Icecast 2
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/icecast
NAME=icecast2
DESC=icecast2

test -x $DAEMON || exit 0

# Defaults
CONFIGFILE="/usr/local/etc/icecast.xml"
CONFIGDEFAULTFILE="/etc/default/icecast2"
USERID=nobody
GROUPID=nobody
ENABLE="true"

# Reads config file (will override defaults above)
[ -r "$CONFIGDEFAULTFILE" ] && . $CONFIGDEFAULTFILE

if [ "$ENABLE" != "true" ]; then
        echo "$NAME daemon disabled - read $CONFIGDEFAULTFILE."
        exit 0
fi

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
                --exec $DAEMON -- -b -c $CONFIGFILE
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
        echo "$NAME."
        ;;
  reload|force-reload)
        echo "Reloading $DESC configuration files."
        start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
        ;;
  restart)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
                --exec $DAEMON -- -b -c $CONFIGFILE
        echo "$NAME."
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

<eof>

I also have setup in /etc/default/icecast2
# Defaults for icecast2 initscript
# sourced by /etc/init.d/icecast2
# installed at /etc/default/icecast2 by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Full path to the server configuration file
CONFIGFILE="/usr/local/etc/icecast.xml"

# Name or ID of the user and group the daemon should run under
USERID=nobody
GROUPID=nobody

# Edit /etc/icecast2/icecast.xml and change at least the passwords.
# Change this to true when done to enable the init.d script
ENABLE=true


<eof>


I have in my icecast.xml file:

    <security>
        <chroot>0</chroot>
        
        <changeowner>
            <user>nobody</user>
            <group>nobody</group>
        </changeowner>
       
    </security>


Thanks for the help!
73
Phil




More information about the Icecast mailing list