mosquitto: systemd support
authorGabe Evans <gabe@hashrabbit.co>
Sat, 31 Oct 2015 21:27:17 +0000 (21:27 +0000)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 2 Nov 2015 20:34:22 +0000 (21:34 +0100)
Signed-off-by: Gabe Evans <gabe@hashrabbit.co>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/mosquitto/mosquitto.mk
package/mosquitto/mosquitto.service [new file with mode: 0644]

index 73365f9e02a3188de94be77a43799f63ade603cc..efeb32d2eef4fcbe4aa79f1b484b774df6574438 100644 (file)
@@ -83,6 +83,14 @@ define MOSQUITTO_INSTALL_INIT_SYSV
                $(TARGET_DIR)/etc/init.d/S50mosquitto
 endef
 
+define MOSQUITTO_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/mosquitto/mosquitto.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/mosquitto.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -fs ../../../../usr/lib/systemd/system/mosquitto.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mosquitto.service
+endef
+
 define MOSQUITTO_USERS
        mosquitto -1 nogroup -1 * - - - Mosquitto user
 endef
diff --git a/package/mosquitto/mosquitto.service b/package/mosquitto/mosquitto.service
new file mode 100644 (file)
index 0000000..2d1939d
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Mosquitto MQTT broker
+
+[Service]
+ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
+ExecReload=/bin/kill -HUP $MAINPID
+Restart=always
+
+[Install]
+WantedBy=multi-user.target