我使用直接下载在我的服务器上安装了 Icecast 2.4.3以获得可用的最新版本。
这样,我不使用我的发行版(debian 8)分发的版本,因此默认情况下没有激活守护进程。
我找到了一个用我的相应路径修改的脚本,但是执行出错了。
脚本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
我在做的时候遇到的错误sh icecast.sh status
:
# sh icecast.sh status
icecast.sh: line 93: status : unknow command
Q1:我该如何解决这个错误?
Q2:我如何获得类似的功能命令icecast restart service
?
Q3 : 如果服务器自行重启,我应该怎么做才能自动重启 Icecast?