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
來源
分享
創建於 2015-09-24T18:29:46Z2015-09-24T18:29:46Z pl_rock