At work we’ve started using some UniFi wireless gear and the system I’ve managed to commandeer to do the control system for it is running Kubuntu 15.04 which uses systemd. Now the UniFi Debian packages don’t supply systemd unit files so I went hunting and found a blog post by Derek Horn about getting it running on CentOS7 so I nabbed his and adapted it for Ubuntu (which wasn’t that hard).
The file lives in /etc/systemd/system/unifi.service
and was enabled with systemctl enable unifi.service
(from memory, there might have been another step that involved getting systemd to rescan unit files to pick up the new one, but I don’t remember for sure).
Here is the unit file:
# # Systemd unit file for unifi-rapid # [Unit] Description=UniFi Wireless AP Control System After=rsyslog.target network.target [Service] Type=simple User=root #ExecStart=/usr/bin/java -Xmx1024M -jar /usr/lib/unifi/lib/ace.jar start ExecStart=/usr/bin/jsvc -nodetach -home /usr/lib/jvm/java-7-openjdk-amd64 -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx1024M com.ubnt.ace.Launcher start #ExecStop=/usr/bin/java -jar /usr/lib/unifi/lib/ace.jar stop ExecStop=/usr/bin/jsvc -home /usr/lib/jvm/java-7-openjdk-amd64 -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx1024M -stop com.ubnt.ace.Launcher stop SuccessStartStatus=0 SuccessExitStatus=255 [Install] WantedBy=multi-user.target