5 [ -z "$JAVA_HOME" -a -f /etc
/profile.d
/jdk.sh
] && .
/etc
/profile.d
/jdk.sh
6 [ -f /etc
/conf.d
/red5
] && .
/etc
/conf.d
/red5
8 [ -z "$RED5_HOME" ] && RED5_HOME
=/opt
/red5
9 [ ! -d "$RED5_HOME" ] && exit -1
10 [ ! -d "$RED5_CONF_DIR" ] && RED5_CONF_DIR
="$RED5_HOME/conf"
11 [ ! -d "$RED5_WORK_DIR" ] && RED5_WORK_DIR
="$RED5_HOME/work"
12 [ ! -d "$RED5_LOG_DIR" ] && RED5_LOG_DIR
="$RED5_HOME/log"
13 [ -z "$RED5_OUT" ] && RED5_OUT
=/dev
/null
14 [ ! -d "$STARTUP_DIR" ] && STARTUP_DIR
="$RED5_HOME"
16 RED5_CLASSPATH
="$RED5_HOME/boot.jar:$RED5_CONF_DIR"
21 [ -f "$RED5_PID" ] && $0 stop
22 stat_busy
'Starting Red5'
24 RED5_OPTS
="$LOGGING_OPTS $SECURITY_OPTS -Dpython.home=lib -Dred5.root=$RED5_HOME -Dred5.config_root=$RED5_CONF_DIR"
25 RED5_MAINCLASS
='org.red5.server.Bootstrap'
26 if [ ! -z "$RED5_USER" -a "$USER" != "$RED5_USER" ]; then
27 su
$RED5_USER -c "exec $JAVA_HOME/bin/java $JAVA_OPTS \
28 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS \
31 pid
=$
(ps
-o ppid
,pid
-U $RED5_USER |
awk "{if(\$1==$!)print\$2}")
32 [ -n "$pid" ] && break
36 $JAVA_HOME/bin
/java
$JAVA_OPTS \
37 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS \
41 if [ -z "$pid" -o ! -e "/proc/$pid" ]; then
45 [ ! -z "$RED5_PID" ] && echo $pid > $RED5_PID
49 [ "$!" != "$pid" ] && exec kill -9 $
! &> /dev
/null
52 rm -rf $RED5_WORK_DIR/red5
*
58 stat_busy
'Stopping Red5'
60 RED5_MAINCLASS
='org.red5.server.Shutdown'
61 if [ ! -z "$RED5_USER" -a "$USER" != "$RED5_USER" ]; then
62 su
$RED5_USER -c "exec $JAVA_HOME/bin/java $JAVA_OPTS $JMX_OPTS \
63 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS $SHUTDOWN_OPTS \
66 $JAVA_HOME/bin
/java
$JAVA_OPTS $JMX_OPTS \
67 $RED5_OPTS -cp $RED5_CLASSPATH $RED5_MAINCLASS $SHUTDOWN_OPTS \
71 [ -e "/proc/$!" ] ||
break
74 [ -e "/proc/$!" ] && kill $
! 2> /dev
/null
&& \
75 sleep 1 && kill -9 $
! 2> /dev
/null
76 [ -f "$RED5_PID" ] && pid
=$
(<$RED5_PID) && kill $pid 2> /dev
/null
&& \
77 sleep 1 && kill -9 $pid 2> /dev
/null
&& sleep 1
78 if [ -z "$pid" -o $?
-eq 0 -a -e "/proc/$pid" ]; then
94 echo "Usage: $0 {start|stop|restart|reload}" >&2