Just like that, explained by self聽 馃檪
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: JBOSS | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 5 | |
# Default-Stop: | |
# Description: Start Jboss Aplication Server 6.2 | |
### END INIT INFO | |
export JBOSS_HOME=/usr/share/jboss/jboss-eap-6.2 | |
start(){ | |
echo "Starting JBoss EAP..." | |
# 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 EAP 6.2 | |
su -l jboss -c '$JBOSS_HOME/bin/standalone.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 EAP 6.2 | |
su -l jboss -c '$JBOSS_HOME/bin/jboss-cli.sh --connect command=:shutdown' | |
} | |
restart(){ | |
su -l jboss -c '$JBOSS_HOME/bin/jboss-cli.sh --connect --command=:reload' | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo "Usage: jboss {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
References
- https://developer.jboss.org/wiki/HowToInstallJBossAS7AsALinuxService
- http://www.mastertheboss.com/jboss-web/jbosswebserver/how-do-you-configure-a-web-application-as-default-web-app
- http://susefaq.sourceforge.net/faq/services.html
Regads