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
/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: 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?