How Linux systems set RED5 to become system services

Source: Internet
Author: User
Tags exit linux

Why do you want to set up a system service? Because I am installed on a server Red5 for no reason, in rc.local there can not be started with the system, LN to RC. X is not a good idea. If you try your best, you have to set up a system service to solve the problem ...

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 $} ' `
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
}
# How we were called.
Case "$" in
Start
Start
;;
Stop
Stop
;;
Restart)
Stop
Sleep 3
Start
;;
*)
echo $ "Usage: $DESCR {start|stop|restart"
Exit 1
Esac
Exit $RETVAL

Note: It is necessary to comment on those contents before. can be repaired.

Put it in the/etc/init.d/.

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

You can start or stop service Red5 start|stop directly

Set to start service Chkconfig Red5 on

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.