Linux系统下怎样把RED5设置为系统服务
2个回答
2016-11-06 · 知道合伙人数码行家
关注
展开全部
首先说说为什么要设置成系统服务?这是由于在某台服务器安装的red5在rc.local那里不能随系统启动,ln到rc.X也不行,只好设置成系统服务才能解决问题,我们可以修改red5.sh
#!/bin/sh
#
#StartupscriptforRed5flashstreamingserver
#
#chkconfig:3458181
#description:RED5byjava
#
#processname:java(unfortunately)
#pidfile:/var/run/red5.pid
#config:/etc/red5.conf
#Sourcefunctionlibrary.
./etc/rc.d/init.d/functions
PID_FILE=/var/run/red5.pid
PID=`psax|grepjava|grepred5|awk'{print$1;}'`
RETVAL=0
start(){
echo-n$"Starting$DESCR:"
#daemonjava$OPTIONS>/dev/null2>&1&
exportANT_HOME=/opt/apache-ant-1.6.5
exportJAVA_HOME=/opt/jdk1.5.0_06
exportJAVA_VERSION=1.5
exportPATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
exec$JAVA_HOME/bin/java-Djava.security.manager-Djava.security.
policy=/opt/red5/conf/red5.policy-cp/opt/red5/red5.jar:conf:
/opt/red5/conforg.red5.server.Standalone>/dev/null2>&1&RETVAL=$?
[$RETVAL=0]&&touch/var/lock/subsys/red5&&echo$!
>$PID_FILE&&echo_success
echo
return$RETVAL
}
stop(){
echo-n$"Stopping$DESCR:"
#killproc$PID_FILE
[[$PID!=""]]&&success&&kill$PID||failure
RETVAL=$?
echo
[$RETVAL=0]&&rm-f/var/lock/subsys/red5$PID_FILE
}
#Seehowwewerecalled.
case"$1"in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep3
start
;;
*)
echo$"Usage:$DESCR{start|stop|restart"
exit1
esac
exit$RETVAL
注意:前面注释那些内容是必须的,可以修改。
放到/etc/init.d/
mv/opt/red5/red5.sh/etc/init.d/red5
也可以直接启动或者停止服务service red5 start|stop
设置成启动服务chkconfig red5 on
#!/bin/sh
#
#StartupscriptforRed5flashstreamingserver
#
#chkconfig:3458181
#description:RED5byjava
#
#processname:java(unfortunately)
#pidfile:/var/run/red5.pid
#config:/etc/red5.conf
#Sourcefunctionlibrary.
./etc/rc.d/init.d/functions
PID_FILE=/var/run/red5.pid
PID=`psax|grepjava|grepred5|awk'{print$1;}'`
RETVAL=0
start(){
echo-n$"Starting$DESCR:"
#daemonjava$OPTIONS>/dev/null2>&1&
exportANT_HOME=/opt/apache-ant-1.6.5
exportJAVA_HOME=/opt/jdk1.5.0_06
exportJAVA_VERSION=1.5
exportPATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
exec$JAVA_HOME/bin/java-Djava.security.manager-Djava.security.
policy=/opt/red5/conf/red5.policy-cp/opt/red5/red5.jar:conf:
/opt/red5/conforg.red5.server.Standalone>/dev/null2>&1&RETVAL=$?
[$RETVAL=0]&&touch/var/lock/subsys/red5&&echo$!
>$PID_FILE&&echo_success
echo
return$RETVAL
}
stop(){
echo-n$"Stopping$DESCR:"
#killproc$PID_FILE
[[$PID!=""]]&&success&&kill$PID||failure
RETVAL=$?
echo
[$RETVAL=0]&&rm-f/var/lock/subsys/red5$PID_FILE
}
#Seehowwewerecalled.
case"$1"in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep3
start
;;
*)
echo$"Usage:$DESCR{start|stop|restart"
exit1
esac
exit$RETVAL
注意:前面注释那些内容是必须的,可以修改。
放到/etc/init.d/
mv/opt/red5/red5.sh/etc/init.d/red5
也可以直接启动或者停止服务service red5 start|stop
设置成启动服务chkconfig red5 on
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
名片
2024-10-28 广告
2024-10-28 广告
Altair HyperWorks是一套功能强大的集成化CAE(计算机辅助工程)软件平台,由Altair公司开发。它涵盖了结构分析、流体动力学、优化、多体动力学、电磁场仿真等多个领域,提供了丰富的仿真工具和优化算法。HyperWorks以其...
点击进入详情页
本回答由名片提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询