Run JBoss as Service HowTo
A short tutorial for JBoss administrator which illustrates how to start JBoss AS as Service both in Windows environment and in Unix-Linux environment.
C:\jboss-5.0.0.GA\bin>service
Usage: service install|uninstall|start|stop|restart|signal
In order to install JBoss AS as Windows service launch:
C:\jboss-5.0.0.GA\bin>service install
Starting JBoss AS service:
C:\jboss-5.0.0.GA\bin>service start
Linux applications use System V Init scripts to run an application when the machine boots.Basically, the scripts which start a service are placed in:
/etc/rc.d/init.d/ (other distributions: /etc/init.d/)
The same scripts need to be linked as:
/etc/rc.(x)/ (Prefixed with S for start and K for stop)
We suggest you reading a good tutorial about Linux Init scripts if you are new to this:
http://www.linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts
jboss_init_hpux.sh
jboss_init_redhat.sh
jboss_init_suse.sh
Copy the appropriate file for your distribution into the /etc/rc.d/init.d folder
cp jboss_init_redhat.sh /etc/rc.d/init.d/jboss
Now you should create a link for each System level so that Linux/Unix knows at which level the application server needs to be started:
ln -s /etc/rc.d/init.d/jboss /etc/rc3.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc5.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc4.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc6.d/K15jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc0.d/K15jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc1.d/K15jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc2.d/K15jboss
We don't go deep into the details of Linux startup system but the links targeted as "S" are launched to start the service at a certain system level. The scripts marked with "K" are launched when the server is shuitting down.
As additional step you need to create a "log" folder in the JBOSS_HOME dir, where the service will send logging:
mkdir $JBOSS_HOME/log

