Hi there, today, we’re going to present a few simple steps to configure and run JBossAS 7 as a service. In this case, we tested with JBossAS 7 on Ubuntu 14.04, but it should also work in other versions.
First of all, create a file in /etc/init.d/, which is the script for the service. This folder contains all the scripts that should run on the startup of a linux instance.
|sudo nano /etc/init.d/jbossas7|
After that, insert the following code, which defines the start and stop commands for the service.
You should replace the variable JBOSS_HOME with your local jboss install folder.
This will run the jboss as a service using the root user, and you can change the commands accordingly to run as a different user.
After this, the only thing remaining is to define when the service will start and shutdown.
Simply run the following two lines:
The first line enables the execution of the created file. The second line creates the symbolic links in /etc/rcX using the options configured in the service script comments (Default-Start and Default-Stop).
In order to test the service before restarting, run:
|sudo service jbossas7 startsudo service jbossas7 stop|