systemd config to autostart Mosquitto broker on Ubuntu 16.04
I am trying to configure Mosquitto broker to autostart on Ubuntu 16.04, but I cannot get systemd set up correctly and keep getting errors. I’ve tried numerous things, with my latest being:
[Unit] Description=Insite MQTT Broker [Service] ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf Restart=always [Install] WantedBy=multi-user.target
When I check systemctl status, I get this:
mosquitto.service - MQTT Broker Loaded: loaded (/etc/systemd/system/mosquitto.service; enabled; vendor preset: enabled) Active: inactive (dead) (Result: exit-code) since Mon 2016-08-22 18:23:13 UTC; 20h ago Main PID: 2696 (code=exited, status=200/CHDIR) Aug 22 18:23:13 main-server-1 systemd: mosquitto.service: Service hold-off time over, scheduling Aug 22 18:23:13 main-server-1 systemd: Stopped MQTT Broker. Aug 22 18:23:13 main-server-1 systemd: mosquitto.service: Start request repeated too quickly. Aug 22 18:23:13 main-server-1 systemd: Failed to start MQTT Broker.
The only tutorials I’ve found for Mosquitto use startup.