mongoose: systemd support
authorAlex Suykov <alex.suykov@gmail.com>
Sat, 23 May 2015 10:05:13 +0000 (13:05 +0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 14 Jul 2015 12:00:04 +0000 (14:00 +0200)
[Thomas: use relative symbolic link.]

Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/mongoose/mongoose.mk
package/mongoose/mongoose.service [new file with mode: 0644]

index 6797e58857a5a3691da651a9bd0b55ca15df0f97..14f2aae152fce4a1b4f8c77a20d5d4b2507e479d 100644 (file)
@@ -36,6 +36,14 @@ define MONGOOSE_INSTALL_INIT_SYSV
                $(TARGET_DIR)/etc/init.d/S85mongoose
 endef
 
+define MONGOOSE_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/mongoose/mongoose.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/mongoose.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -sf ../../../../usr/lib/systemd/system/mongoose.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mongoose.service
+endef
+
 define MONGOOSE_INSTALL_STAGING_CMDS
        $(INSTALL) -D -m 644 $(@D)/libmongoose.a \
                $(STAGING_DIR)/usr/lib/libmongoose.a
diff --git a/package/mongoose/mongoose.service b/package/mongoose/mongoose.service
new file mode 100644 (file)
index 0000000..12a731c
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Mongoose HTTP server
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/mongoose -document_root /var/www -listening_port 80
+Restart=always
+
+[Install]
+WantedBy=multi-user.target