UBUNTU SERVER 9.04 配置 RED5 开机启动
2009-10-29 17:35
381 查看
新建一个文件拷贝到/etc/initd.d/red5
文件内容:
Code
#!/bin/sh
#This is a red5 start/stop script on debian/ubuntu
#You will need to have screen installed
#red5 is started in its own screen, allowing debug
#for now, exept debug screen, there is no log
# Construct vars
#exe is the full path to the executable
name="Red5"
log_dir="/opt/red5/log"
workdir="/opt/red5/"
exe="./red5.sh"
#time=`echo $(date +%Y%m%d)_$(date +%H_%M_%S)`
# notify if no option is given
if [ $# -ne 1 ]; then
echo "Usage: $0 (start|stop|restart|status|debug) "
exit
fi
Start()
{
cd $tmp_dir
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null; then
echo "$name is running, stop first to restart!"
else
#mv $log_dir/red5.log $log_dir/red5.log.$time
cd $workdir
$exe
echo "$name started"
fi
}
Stop()
{
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null; then
echo "$name is runningStopping now"
ps -ef | grep "$exe" | grep -v grep | awk ' { print $2 } '| xargs kill > /dev/null
else
echo "$name not running"
fi
}
Status()
{
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null ; then
echo "$name is running!"
else
echo "$name is not running!"
fi
}
Debug()
{
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null ; then
echo "$name is running!"
echo "You will now debug $name, to quit debugging press CTRL+A+D"
echo "DON'T USE CTRL+C, You will kill $name!"
echo "Press any key to continue"
read TA
/usr/bin/screen -r SCREEN_$name
else
echo "$name is not running!"
fi
}
# MAIN
case "$1" in
start)
Start
;;
stop)
Stop
;;
restart)
Stop
sleep 2
Start
;;
debug)
Debug
;;
status)
Status
;;
esac
exit 0
然后运行
cd /etc/init.d/
update-rc.d red5 defaults
可以通过
/etc/init.d/red5 start
启动服务
重启系统后red5服务随开机启动
文件内容:
Code
#!/bin/sh
#This is a red5 start/stop script on debian/ubuntu
#You will need to have screen installed
#red5 is started in its own screen, allowing debug
#for now, exept debug screen, there is no log
# Construct vars
#exe is the full path to the executable
name="Red5"
log_dir="/opt/red5/log"
workdir="/opt/red5/"
exe="./red5.sh"
#time=`echo $(date +%Y%m%d)_$(date +%H_%M_%S)`
# notify if no option is given
if [ $# -ne 1 ]; then
echo "Usage: $0 (start|stop|restart|status|debug) "
exit
fi
Start()
{
cd $tmp_dir
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null; then
echo "$name is running, stop first to restart!"
else
#mv $log_dir/red5.log $log_dir/red5.log.$time
cd $workdir
$exe
echo "$name started"
fi
}
Stop()
{
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null; then
echo "$name is runningStopping now"
ps -ef | grep "$exe" | grep -v grep | awk ' { print $2 } '| xargs kill > /dev/null
else
echo "$name not running"
fi
}
Status()
{
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null ; then
echo "$name is running!"
else
echo "$name is not running!"
fi
}
Debug()
{
if ps -ef | grep SCREEN_$name | grep -v grep > /dev/null ; then
echo "$name is running!"
echo "You will now debug $name, to quit debugging press CTRL+A+D"
echo "DON'T USE CTRL+C, You will kill $name!"
echo "Press any key to continue"
read TA
/usr/bin/screen -r SCREEN_$name
else
echo "$name is not running!"
fi
}
# MAIN
case "$1" in
start)
Start
;;
stop)
Stop
;;
restart)
Stop
sleep 2
Start
;;
debug)
Debug
;;
status)
Status
;;
esac
exit 0
然后运行
cd /etc/init.d/
update-rc.d red5 defaults
可以通过
/etc/init.d/red5 start
启动服务
重启系统后red5服务随开机启动
相关文章推荐
- ubuntu 17.04源码安装nginx1.12.2并配置开机启动
- ubuntu启动各项功能配置+开机自动启动
- ubuntu中ssh-server的安装与开机启动
- ubuntu配置开机启动服务
- 配置GRUB 2:调整Ubuntu Server 9.10中的启动程序_/etc/default/GRUB分析
- Ubuntu nginx 开机启动配置
- Ubuntu配置tomcat开机自动启动
- Linux->Ubuntu配置tomcat开机自动启动
- ubuntu中ssh-server的安装与开机启动
- sysv-rc-conf管理Ubuntu server开机启动服务
- ubuntu配置开机启动服务
- UBUNTU SERVER 9.04 中 安装 RED5
- ubuntu配置开机启动服务
- Ubuntu配置mysql开机自动启动
- sysv-rc-conf管理Ubuntu server开机启动服务
- Ubuntu12配置Oracle11G 开机启动服务
- 配置ubuntu 开机启动xampp
- 配置ubuntu开机自动启动samba服务命令
- sysv-rc-conf管理Ubuntu server开机启动服务