Tag Archives: jboss eap as service

How to configure JBOSS EAP 7 as a service in SUSE Linux

Step by step procedure to configure JBOSS EAP as service in SUSE Linux

JBOSS EAP as service

One of the major requirements for Jboss’s basic installations is to configure Jboss as a service in Linux. It’s pretty easy to configure it in RedHat and related families but when it comes to SUSE it pretty difficult since few functions of RedHat family don’t work in Suse. And with default ZIP installation we do not get the SUSE startup file as well which is readily available for RedHat.

We are considering Jboss EAP 7.2 on Suse 12 for this article.

RedHat has a pretty simple tutorial here which is not going to work on SUSE. So I will walk you through steps to get your Jboss eap working as service in SUSE Linux.


Pre-requisite

  • Make sure you have java installed on the server
  • Make sure JBoss user exists on the server which is defined in jboss-eap.conf file by parameter JBOSS_USER. Default user is jboss-eap
  • For default standalone configurations, INSTALL_PATH/standalone/ should be owned by JBOSS_USER
  • Make changes in init script template to match it with SUSE system as defined in below paragraph

Modification in script

You need to edit default init script INSTALL_PATH/bin/init.d/jboss-eap-rhel.sh to make it compatible with Suse.

  • Replace /etc/init.d/functions with /etc/rc.status
  • Replace success with rc_status -v

With JBoss zip install, you will have init script jboss-eap-rhel.sh located under INSTALL_PATH/bin/init.d This is init script which won’t be useful in latest Suse versions since they follow LSB format. So we need to make it work with LSB and here is how to do it.

Copy service configuration file and service init script from the installation directory to respective system directories –

root@kerneltalks # cp INSTALL_PATH/bin/init.d/jboss-eap.conf /etc/default
root@kerneltalks # cp INSTALL_PATH/bin/init.d/jboss-eap-rhel.sh /etc/init.d/jboss-eap
root@kerneltalks # chmod +x /etc/init.d/jboss-eap

Please note that while coping over file we trimmed rhel from its name since it does not make sense to keep that name on the SUSE system! It will also alter the next command as well.


Adding it as a service

root@kerneltalks # chkconfig --add jboss-eap

Till this point, its the same process as RedHat mentioned in its tutorial. Now, if you try to start service it won’t. It will throw below error :

root@kerneltalks # service jboss-eap start
jboss-eap.sh is neither service nor target!?

Import service in sytemd

Now we need to get this service into systemd. To do that, You need to add below block on top of /etc/init.d/jboss-eap.sh . Make sure you edit it exactly since its an LSB compliant format read by the system. This needs to go below the shell opening line of script !/bin/sh and before the rest of the script.

### BEGIN INIT INFO
# Provides:          jboss-eap
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: jboss eap service
# Description:       jboss eap server for suse linux
### END INIT INFO

You are almost there! Import the service into systemd using below command –

root@kerneltalks # systemctl enable jboss-eap
jboss-eap.service is not a native service, redirecting to systemd-sysv-install
Executing /usr/lib/systemd/systemd-sysv-install enable jboss-eap

Now your service is available in systemctl to control. You can control service using commands like systemctl start jboss-eap, systemctl stop jboss-eap, systemctl status jboss-eap

root@kerneltalks # systemctl start jboss-eap
● jboss-eap-rhel.service - LSB: jboss eap service
   Loaded: loaded (/etc/init.d/jboss-eap-rhel.sh; bad; vendor preset: disabled)
   Active: active (running) since Thu 2019-06-20 1:23:23 IST; 10s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 10625 ExecStart=/etc/init.d/jboss-eap-rhel.sh start (code=exited, status=0/SUCCESS)
 Main PID: 12346 (java)
......

You have configured Jboss eap to run as service in Suse Linux.