如何在Ubuntu 14.04上添加Red5後台啟動?


0

我按照此處的說明通過tarball手動安裝red5,因為apt-get不適用於Ubuntu 14.04:Ubuntu Trusty red5-server installation fails to start

即使手動安裝依賴項,服務器也總是會失敗。red5服務器現在可以工作,但是終端必須處於打開狀態並僅掛在這裡。我需要一個啟動腳本才能在後台運行該過程。這裡的對話:http://chat.stackexchange.com/rooms/29197/discussion-between-umi-and-pl-rock

我遵循了,但是無法正常工作。現在的結果是:

init.d/red5中,我有兩行-start on filesystemexec /bin/bash /usr/share/red5.sh

update rc.d red5 defaults返回:

missing LSB information

sudo service red5 stop返回:

stop: Unknown instance

sudo service red5 start返回:

red5 stop/waiting
2

sorry by mistake i wrote there wrong syntax in chat .

First method :

create any file under /etc/init.d

sudo nano /etc/init.d/red5

add lines

 #!/bin/sh
cd /full-path/red5-server-1.0.6-RELEASE/ && ./red5.sh &

save this file and exit then make it executable

sudo chmod ugo+x /etc/init.d/red5

then run command

sudo update-rc.d red5 defaults

your problem is solved. you can start it using

sudo service red5 start

Second method :

you can use /etc/rc.local.
/etc/rc.local is where you can customize your own daemon to run in the background. Daemon is what does the job in running whichever scripts you want system to run in the background. This is where the system picks up to start daemons before releasing the system to you for your use.

open it using command

sudo nano /etc/rc.local

add bellow command before exit 0

cd /full_path/red5-server-1.0.6-RELEASE/ && ./red5.sh &

and you can test if this is working correctly or not

sh /etc/rc.local

next time you start your system or reboot your red5 server will run in background. it will work.

Third method :

create any .conf file under /etc/init

sudo nano /etc/init/red5.conf

add bellow lines

start on runlevel [2345]
stop on runlevel [016]
exec /full-path/red5-server-1.0.6-RELEASE/red5.sh

now you start server

sudo service red5 start

if you want to create better upstart then read Upstart Intro, Cookbook and Best Practises