Jens Krämer

How to Control JBoss With systemd

 |  systemd, jboss, sysadmin, linux  |  2 comments

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.



Works perfectly. (I configured JAVA_OPTS in standalone.conf so I removed them from this script)

Thank you very much!!!


You might want to include a "ExecStop" command to shutdown (yes, sometimes they want to shutdown Jboss on purpose ;-) ) the server?

You can use Markdown here.

For the sake of spam checking any data you submit, including your IP address, will be transferred to the US based Akismet web service ( If that's not acceptable for you, you can also reach me by other means.