我使用direct download在我的服务器上安装了Icecast 2.4.3以获取最新版本。如何将icecast制作为服务并重新启动?
这样,我不使用我的发行版(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?
感谢您的解释以及重新启动后如何启动 – Zl3n