Last active
August 29, 2015 14:04
-
-
Save tmarwen/2bf2e66014b346aef748 to your computer and use it in GitHub Desktop.
Straightforward script to init jboss AS as *nix service
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 | |
# Use --debug to activate debug mode with an optional argument to specify the port. | |
# Usage : standalone.bat --debug | |
# standalone.bat --debug 9797 | |
# By default debug mode is disable. | |
#!/bin/bash### BEGIN INIT INFO | |
# Provides: jbossas7 | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/Stop JBoss AS 7 | |
### END INIT INFO | |
# chkconfig: 35 92 1 | |
## Include some script files in order to set and export environmental variables | |
## as well as add the appropriate executables to $PATH. | |
[ -r /home/marwen/jboss.sh ] && . /home/marwen/jboss.sh | |
AS7_OPTS="$AS7_OPTS -Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=true" ## See AS7-1625 | |
AS7_OPTS="$AS7_OPTS -Djboss.bind.address.management=0.0.0.0" | |
AS7_OPTS="$AS7_OPTS -Djboss.bind.address=0.0.0.0" | |
case "$1" in | |
start) | |
echo "Starting JBoss AS 7..." | |
sudo -u marwen sh ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS ## If running as user "jboss" | |
#start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS ## Ubuntu | |
#${JBOSS_HOME}/bin/standalone.sh & | |
;; | |
stop) | |
echo "Stopping JBoss AS 7..." | |
sudo -u marwen sh ${JBOSS_HOME}/bin/jboss-admin.sh --connect command=:shutdown ## If running as user "jboss" | |
#start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin/jboss-admin.sh -- --connect command=:shutdown ## Ubuntu | |
#${JBOSS_HOME}/bin/jboss-cli.sh --connect command=:shutdown | |
;; | |
*) | |
echo "Usage: /etc/init.d/jboss {start|stop}"; exit 1; | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment