Created
March 26, 2014 22:31
-
-
Save jaehoo/9795146 to your computer and use it in GitHub Desktop.
jboss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: JBOSS | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 5 | |
# Default-Stop: | |
# Description: Start Jboss Aplication Server 5.1 to allow and provide QA Environment the "Publicador Promociones" | |
### END INIT INFO | |
export JBOSS_HOME=/opt/jboss-5.1.0.GA | |
start(){ | |
echo "Starting jboss..." | |
# If using an SELinux system such as RHEL 4, use the command below | |
# instead of the "su": | |
# eval "runuser - jboss -c '/opt/jboss/current/bin/run.sh > /dev/null 2> /dev/null &' | |
# if the 'su -l ...' command fails (the -l flag is not recognized by my su cmd) try: | |
$JBOSS_HOME/bin/run.sh -Djboss.as.deployment.ondemand=false -b 0.0.0.0 > /dev/null 2> /dev/null & | |
#Su -l jboss -c '$JBOSS_HOME/bin/run.sh > /dev/null 2> /dev/null &' | |
} | |
stop(){ | |
echo "Stopping jboss..." | |
# If using an SELinux system such as RHEL 4, use the command below | |
# instead of the "su": | |
# eval "runuser - jboss -c '/opt/jboss/current/bin/shutdown.sh -S &' | |
# if the 'su -l ...' command fails try: | |
$JBOSS_HOME/bin/shutdown.sh -S & | |
#su -l jboss -c '$JBOSS_HOME/bin/shutdown.sh -S &' | |
} | |
restart(){ | |
stop | |
# give stuff some time to stop before we restart | |
sleep 60 | |
# protect against any services that can't stop before we restart (warning this kills all Java instances running as 'jboss' user) | |
#su -l jboss -c 'killall java' | |
# if the 'su -l ...' command fails try: | |
# sudo -u jboss killall java | |
start | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo "Usage: jboss {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment