Reputation: 7853
I installed Icecast 2.4.3 on my server using direct download to get the latest version available.
In this way, I don't use the version distributed by my distribution (debian 8) and thus don't have the daemon activated by default.
I found a script that I modified with my corresponding paths, but the execution is in error.
The script icecast.sh
:
#!/bin/bash
#
# Init file for Icecast server daemon
#
# chkconfig: 345 55 25
# description: Icecast streaming mp3 server daemon
#
# processname: icecast
# config: /etc/icecast.xml
# pidfile: /var/run/icecast.pid
# source function library
# . /etc/rc.d/init.d/functions : returns an error on debian 8
. /lib/lsb/init-functions
# pull in sysconfig settings
[ -f /etc/sysconfig/icecast ] && . /etc/sysconfig/icecast
RETVAL=0
prog="icecast"
# Some functions to make the below more readable
PREFIX=/usr/local
PATH=$PATH:$PREFIX/bin
PIDFILE=/icecast/icecast.pid
CONF_FILE=/icecast/conf/icecast.xml
[ -f $PREFIX/bin/icecast ] || ( echo Failed to locate icecast binary: $PREFIX/bin/icecast && exit )
[ -f $CONF_FILE ] || ( echo Failed to locate icecast configuration file: $CONF_FILE && exit )
OPTIONS="-b -c $CONF_FILE"
start()
{
echo -n $"Starting $prog:"
ulimit -c unlimited # dump core for debugging purposes
ulimit -n 32768
daemon icecast icecast $OPTIONS
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/icecast
echo
pidof icecast > $PIDFILE
return $RETVAL
}
stop()
{
echo -n $"Stopping $prog:"
killproc icecast -TERM
RETVAL=$?
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/icecast
echo
rm -f $PIDFILE
return $RETVAL
}
reload()
{
echo -n $"Reloading $prog:"
killproc icecast -HUP
RETVAL=$?
echo
return $RETVAL
}
condrestart()
{
[ -e /var/lock/subsys/icecast ] && restart
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
# wait for listening sockets to clear
echo "Waiting 5 seconds before restarting..."
sleep 5
start
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
status icecast
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
RETVAL=1
esac
exit $RETVAL
And the error I'm getting when I'm doing sh icecast.sh status
:
# sh icecast.sh status
icecast.sh: line 93: status : unknow command
Q1: How do I fix this error?
Q2: How do I get a functional command like icecast restart service
?
Q3: What should I do to restart Icecast automatically if the server restarts itself?
Upvotes: 1
Views: 15914
Reputation: 2730
apt-get install icecast2
, yum install icecast
, whatever). Usually pakage manager also installs init scripts that will allow you start/stop Icecast.which icecast
or whereis icecast
/etc/inid/icecast restart
or systemctr restart icecast
should work now with your version of Icecast.systemctl enable icecast
Upvotes: 1
Reputation: 2880
The answer is to use the proper package from either debian backports or if you e.g. need TLS support the package from official Xiph.org repositories.
This guarantees, that you will receive package updates without having to monitor releases yourself and figure out necessary changes.
Also please note that the latest release for Linux/Unix at this time is 2.4.2, as 2.4.3 was a Windows only release. The code is identical if compiled for Linux/Unix.
Upvotes: 2