Recently I rebuilt my Openfire server from scratch on a new box, and I’m trying to get it to start on boot.
My old server was running Ubuntu 14.04 and I eventually figured out how to automate the start on boot using upstart. The new server is running Ubuntu 16.04 which uses systemd rather than upstart and I’m having troubles getting the start on boot to work. Sorry I’m a bit of a hack/n00b with all things *nix; I generally get there in the end but this one is confounding me and I sure would appreciate a nudge in the right direction.
Normally from the command line I start Openfire with:
sudo -u openfire /opt/openfire/bin/openfire start
I’ve tried a few variants but I’ll detail one here that seemed like it should work:
Step 1: created new systemd unit file:
sudo nano /lib/systemd/system/openfire.service
Step 2: put the following in the file:
[Unit] Description=OpenFire Start on Boot [Service] User=openfire ExecStart=/bin/sh -c "/opt/openfire/bin/openfire start" [Install] WantedBy=multi-user.target
Step 3: saved file and enabled service using:
sudo systemctl enable openfire.service
Step 4: rebooted and checked status:
sudo -u openfire /opt/openfire/bin/openfire status
Result: “openfire is stopped.”
I’m quite certain the issue is with the ExecStart directive. Can some generous soul help?