Skip to content

Instantly share code, notes, and snippets.

@cygmris
Forked from nbluis/gist:1408921
Created December 8, 2016 20:07
Show Gist options
  • Save cygmris/4e46edd69f1305a01d009d4d828dab82 to your computer and use it in GitHub Desktop.
Save cygmris/4e46edd69f1305a01d009d4d828dab82 to your computer and use it in GitHub Desktop.
JBoss 7 Simple Startup Script
#!/bin/sh
### BEGIN INIT INFO
# Reference: http://stackoverflow.com/questions/6880902/start-jboss-7-as-a-service-on-linux
# Provides: jboss
# 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 v7.0.0
### END INIT INFO
#
#source some script files in order to set and export environmental variables
#as well as add the appropriate executables to $PATH
#[ -r /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh
#[ -r /etc/profile.d/jboss.sh ] && . /etc/profile.d/jboss.sh
export JBOSS_HOME=/opt/jboss-as-web-7.0.2.Final/
case "$1" in
start)
echo "Starting JBoss AS 7.0.0"
sudo -u jboss sh ${JBOSS_HOME}/bin/standalone.sh > /dev/null 2>&1 &
;;
stop)
echo "Stopping JBoss AS 7.0.0"
sudo -u jboss sh ${JBOSS_HOME}/bin/jboss-admin.sh --connect command=:shutdown > /dev/null 2>&1 &
;;
*)
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