Jens Krämer

How to Control JBoss With systemd

 |  systemd, jboss, sysadmin, linux

Recently I set up JBoss on a fresh Debian install, and took the chance to introduce myself to systemd, the thing that is supposed to replace the good old SysV init system.

The JBoss download only came with an old style init script, so here’s the systemd service definition I came up with:

Description=Jboss Application Server

Environment=JAVA_HOME=/opt/java JBOSS_HOME=/opt/jboss JAVA=/opt/java/bin/java JBOSS_LOG_DIR=/var/log/jboss "JAVA_OPTS=-Xms1024m -Xmx20480m -XX:MaxPermSize=768m"


Simply place this into /etc/systemd/system/jboss-as-standalone.service and edit the Environment line to suit your installation paths / desired Java options. Then run systemctl daemon-reload to make systemd recognize the new file. You can now start/stop JBoss using systemctl {stop|start} jboss-as-standalone.service. To activate automatic startup on boot run systemctl enable jboss-as-standalone.service.

That’s it! If you ask me, the switch to systemd is a huge step into the right direction.