Skip to contentSkip to conversation

mosquitto: systemd support

PATCH New Gabe Evans 2 participants 2 messages Oct 31, 2015 – Nov 2, 2015

lore
Share & tools
lore

Gabe Evans

author
#0 lore raw

PATCH 1/1 mosquitto: systemd support

---
 package/mosquitto/mosquitto.mk      |  8 ++++++++
 package/mosquitto/mosquitto.service | 10 ++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/mosquitto/mosquitto.service
package/mosquitto/mosquitto.mk +8 -0
index 73365f9..efeb32d 100644
@@ -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
package/mosquitto/mosquitto.service new file +10 -0
new file mode 100644
index 0000000..2d1939d
@@ -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
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 mosquitto: systemd support

Dear Gabe Evans,

Quoted 6 lines · Gabe Evans
---
 package/mosquitto/mosquitto.mk      |  8 ++++++++
 package/mosquitto/mosquitto.service | 10 ++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/mosquitto/mosquitto.service

I don't fully understand the systemd thing, but this looked reasonable, so I've applied. Systemd people in the Buildroot community are invited to comment/review a bit more on systemd related things :)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com