Title / Description
Code #!/bin/sh # #http://wiki.openkm.com/index.php/Configure_JBoss_service ### BEGIN INIT INFO # Provides: jboss # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start and stop JBoss AS # Description: Enable JBoss AS service provided by daemon. ### END INIT INFO ECHO=/bin/echo TEST=/usr/bin/test JBOSS_USER=jboss JBOSS_IP=0.0.0.0 JBOSS_HOME=/opt/jboss JBOSS_MODE=default JBOSS_START_SCRIPT=$JBOSS_HOME/bin/run.sh JBOSS_STOP_SCRIPT=$JBOSS_HOME/bin/shutdown.sh $TEST -x $JBOSS_START_SCRIPT || exit 0 $TEST -x $JBOSS_STOP_SCRIPT || exit 0 start() { $ECHO "Starting JBoss" $ECHO "su - $JBOSS_USER -c cd $JBOSS_HOME/bin; $JBOSS_START_SCRIPT -c $JBOSS_MODE -b $JBOSS_IP > /dev/null &" su - $JBOSS_USER -c "cd $JBOSS_HOME/bin; $JBOSS_START_SCRIPT -c $JBOSS_MODE -b $JBOSS_IP > /dev/null &" $ECHO "." } stop() { $ECHO -n "Stopping JBoss" su - $JBOSS_USER -c "$JBOSS_STOP_SCRIPT -s $JBOSS_IP > /dev/null &" while [ "$(ps -fu $JBOSS_USER | grep java | grep jboss | wc -l)" -gt "0" ]; do sleep 5; $ECHO -n "." done $ECHO "." } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 30 start ;; *) $ECHO "Usage: jboss {start|stop|restart}" exit 1 esac exit 0
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code