Simple JBoss AS 7 Server Startup Script for Linux

I covered in a previous post of setting up a standard JBoss application server. In the post, I gave a shot script to start the JBoss application server. Below would be a standard way of install JBoss as a service script to run at boot time.


#!/bin/sh
#chkconfig: 345 99 10
#description: JBoss auto start-stop script.

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

### CHANGE THE STARTUP PATH TO YOUR START SCRIPT ###

startup='/home/jboss/jboss-as-web-7.0.2.Final/bin/standalone.sh > /dev/null 2> /dev/null &'
shutdown='killall java'

start(){
echo -n $"Starting JBoss service: "
$startup
RETVAL=$?
echo
}

stop(){
action $"Stopping JBoss service: " $shutdown
RETVAL=$?
echo
}

restart(){
stop
sleep 10
start
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac

1: Name and add it to /etc/init.d
2: chmod 755 jboss
3: chkconfig –add jboss && chkconfig jboss on

Command Usage
service jboss start
service jboss stop
servoce jboss restart

Enjoy,
Jason Rogers

, , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

You might also likeclose