0

I manually start openfire using the following command:

sudo -u openfire /opt/openfire/bin/openfire start

Under Ubuntu 14.04, I eventually figured out I could start it automatically on boot using the following upstart file openfire.conf:

description "Openfire launch on boot"
start on startup
task
exec start-stop-daemon --start --quiet -c openfire --exec /opt/openfire/bin/openfire -- start

I have now rebuilt my server on Ubuntu 16.04 and would like to achieve the same thing using systemd. I created unit file /lib/systemd/system/openfire.service:

[Unit]
Description=OpenFire Start on Boot

[Service]
User=openfire
ExecStart=/bin/sh -c "/opt/openfire/bin/openfire start"

[Install]
WantedBy=multi-user.target

This does not work. After saving the unit file and activating it with sudo systemctl enable openfire.service and rebooting, I check the status with sudo -u openfire /opt/openfire/bin/openfire status and get the result openfire is stopped.

To debug I tried setting LogLevel=debug in /etc/systemd/system.conf, rebooted again, then tried journalctl -u openfire which returned the following single line:

Feb 19 11:51:19 DK-Openfire-B systemd[1]: Started OpenFire Start on Boot.

Which really didn't help me. I suspect the issue is with my ExecStart statement. Any tips on what I am doing wrong or how to get further debug info?

0

I figured it out. I just had to add 'Type=forking' to the [Service] section of the unit file. The following unit file works as desired:

[Unit]
Description=OpenFire Start on Boot

[Service]
Type=forking
User=openfire
ExecStart=/bin/sh -c "/opt/openfire/bin/openfire start"

[Install]
WantedBy=multi-user.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.