5 # chkconfig: 2345 70 30
6 # description: Open-Source Flash Server
7 # config: /etc/sysconfig/red5
9 .
/etc
/init.d
/functions
11 [ -f /etc
/sysconfig
/red5
] && .
/etc
/sysconfig
/red5
13 [ -z "$RED5_HOME" ] && RED5_HOME
=/opt
/red5
14 [ ! -d "$RED5_HOME" ] && exit -1
15 [ ! -d "$RED5_CONF_DIR" ] && RED5_CONF_DIR
="$RED5_HOME/conf"
16 [ ! -d "$RED5_WORK_DIR" ] && RED5_WORK_DIR
="$RED5_HOME/work"
17 [ ! -d "$RED5_LOG_DIR" ] && RED5_LOG_DIR
="$RED5_HOME/log"
18 [ -z "$RED5_OUT" ] && RED5_OUT
=/dev
/null
19 [ ! -d "$STARTUP_DIR" ] && STARTUP_DIR
="$RED5_HOME"
21 RED5_CLASSPATH
="$RED5_HOME/boot.jar:$RED5_CONF_DIR"
26 [ -f "$RED5_PID" ] && $0 stop
27 echo -n 'Starting Red5: '
29 RED5_OPTS
="$LOGGING_OPTS $SECURITY_OPTS -Dpython.home=lib -Dred5.root=$RED5_HOME -Dred5.config_root=$RED5_CONF_DIR"
30 RED5_MAINCLASS
='org.red5.server.Bootstrap'
31 if [ ! -z "$RED5_USER" -a "$USER" != "$RED5_USER" ]; then
32 su
$RED5_USER -c "exec $JAVA_HOME/bin/java $JAVA_OPTS \
33 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS \
36 pid
=$
(ps
-o ppid
,pid
-U $RED5_USER |
awk "{if(\$1==$!)print\$2}")
37 [ -n "$pid" ] && break
41 $JAVA_HOME/bin
/java
$JAVA_OPTS \
42 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS \
46 if [ -z "$pid" -o ! -e "/proc/$pid" ]; then
50 [ ! -z "$RED5_PID" ] && echo $pid > $RED5_PID
51 touch /var
/lock
/subsys
/red5
&& success || failure
; echo
53 [ "$!" != "$pid" ] && exec kill -9 $
! &> /dev
/null
56 rm -rf $RED5_WORK_DIR/red5
*
62 echo -n 'Stopping Red5: '
64 RED5_MAINCLASS
='org.red5.server.Shutdown'
65 if [ ! -z "$RED5_USER" -a "$USER" != "$RED5_USER" ]; then
66 su
$RED5_USER -c "exec $JAVA_HOME/bin/java $JAVA_OPTS $JMX_OPTS \
67 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS $SHUTDOWN_OPTS \
70 $JAVA_HOME/bin
/java
$JAVA_OPTS $JMX_OPTS \
71 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS $SHUTDOWN_OPTS \
75 [ -e "/proc/$!" ] ||
break
78 [ -e "/proc/$!" ] && kill $
! 2> /dev
/null
&& \
79 sleep 1 && kill -9 $
! 2> /dev
/null
80 [ -f "$RED5_PID" ] && pid
=$
(<$RED5_PID) && kill $pid 2> /dev
/null
&& \
81 sleep 1 && kill -9 $pid 2> /dev
/null
&& sleep 1
82 if [ -z "$pid" -o $?
-eq 0 -a -e "/proc/$pid" ]; then
87 rm -f /var
/lock
/subsys
/red5
&& success || failure
; echo
99 echo "Usage: $0 {start|stop|restart|reload}" >&2