Set RED5 as a system service in linux

Source: Internet
Author: User
In linux, set RED5 as the system service-Linux Enterprise Application-Linux server application information. The following is a detailed description. Why should we set it to a system service? Because the red5 I installed on a server does not know why, in rc. local cannot start with the system, ln to rc. X does not work either. try your best to solve the problem by setting it to a system service...

Modify red5.sh

#! /Bin/sh
#
# Startup script for Red5 flash streaming server
#
# Chkconfig: 345 81 81
# Description: RED5 by java
#
# Processname: java (unfortunately)
# Pidfile:/var/run/red5.pid
# Config:/etc/red5.conf


# Source function library.
./Etc/rc. d/init. d/functions

PID_FILE =/var/run/red5.pid
PID = 'ps ax | grep java | grep red5 | awk '{print $1 ;}''
RETVAL = 0

Start (){
Echo-n $ "Starting $ DESCR :"
# Daemon java $ OPTIONS>/dev/null 2> & 1 &

Export ANT_HOME =/opt/apache-ant-1.6.5
Export JAVA_HOME =/opt/jdk1.5.0 _ 06
Export Java version = 1.5
Export PATH = $ 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/conf org. red5.server. standalone>/dev/null 2> & 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
}

# See how we were called.
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Restart)
Stop
Sleep 3
Start
;;
*)
Echo $ "Usage: $ DESCR {start | stop | restart"
Exit 1
Esac

Exit $ RETVAL


Note: The preceding comments are required. You can modify them.

Put it in/etc/init. d/

Mv/opt/red5/red5.sh/etc/init. d/red5

You can directly start or stop the service red5 start | stop

Set to start the chkconfig red5 on Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.