This page looks best with JavaScript enabled

systemd service for Apache OFBiz

 ·  ☕ 2 min read  ·  ✍️ FJTC

The Apache OFBiz is an Apache top-level project that implements a fully functional open source ERP. As any other application server, it is interesting to control its startup using either Upstart or systemd. Based on my previous post Creating Red Hat Wildfly systemd service for Ubuntu 16.04, I created a very simple systemd script to control the start/stop of the OFBiz service.

This file is called ofbiz.service and is located inside the directory /etc/systemd/system:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[Unit]
Description=OFBiz Service
After=network.target auditd.service

[Service]
User=<user of ofbiz>
WorkingDirectory=<home of OFBiz>
ExecStart=<home of OFBiz>/ant start
ExecStop=<home of OFBiz>/ant stop

[Install]
WantedBy=multi-user.target

This systemd service uses the Apache Ant scripts to start and stop OFBiz so it was necessary to add the WorkingDirectory directive to ensure that Ant will run inside the home directory of the application. It is important to notice that this service definition will use the Ant binaries that comes with the OFBiz distribution package so it is not necessary to install an external copy of Ant in order to use this systemd service definition script.

If you are using an external database service as well, make sure that OFBiz will not start only after the DBMS service by adding the service name into the directive After: This is an example for the PostgreSQL database:

1
2
3
[Unit]
Description=OFBiz Service
After=network.target auditd.service postgresql.service

After the script is ready, you will need to refresh the systemd daemon in order to make it available to be used. Furthermore, the service will not be enabled by default, so do not forget to enable it in order to get it up automatically after a system reboot. For further information about the handling of the please check the post Creating Red Hat Wildfly systemd service for Ubuntu 16.04.

Share on

FJTC
WRITTEN BY
FJTC
Co-Founder of InterlockLedger Network