This following script is the sample to start up the jboss as a service at boot time. This script must be created in /etc/init.d/ directory

in the name of Jboss and full permission should be given to it i.e, chmod 777 will do that.

 

#!/bin/sh
### BEGIN INIT INFO
# 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: Management of JBoss AS v7.x
### END INIT INFO

#Defining JBOSS_HOME
JBOSS_HOME=/opt/jboss

case “$1” in
start)
echo “Starting JBoss AS7…”
sudo -u jboss sh ${JBOSS_HOME}/bin/standalone.sh –server-config=standalone-full.xml &
;;
stop)
echo “Stopping JBoss AS7…”
sudo -u jboss sh ${JBOSS_HOME}/bin/jboss-cli.sh –connect command=:shutdown
;;
log)
echo “Showing server.log…”
tail -1000f ${JBOSS_HOME}/standalone/log/server.log
;;
*)
echo “Usage: /etc/init.d/jboss {start|stop|log}”
exit 1
;; esac
exit 0

Advertisements