thttpd: add systemd service file
authorMike Williams <mike@mikebwilliams.com>
Fri, 20 Mar 2015 19:14:11 +0000 (15:14 -0400)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 20 Mar 2015 19:43:31 +0000 (20:43 +0100)
Based on Arch service file, adjusted to point to /usr/sbin.

Signed-off-by: Mike Williams <mike@mikebwilliams.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/thttpd/thttpd.mk
package/thttpd/thttpd.service [new file with mode: 0644]

index 1a028c87379441005119507c5648982adbc04151..5b4b0c45919dd691ae0656523475141e466ed758 100644 (file)
@@ -44,4 +44,12 @@ define THTTPD_INSTALL_INIT_SYSV
        $(SED) 's:/usr/local/sbin:/usr/sbin:g' $(TARGET_DIR)/etc/init.d/S90thttpd
 endef
 
+define THTTPD_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 0644 package/thttpd/thttpd.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/thttpd.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/
+       ln -fs ../../../../usr/lib/systemd/system/thttpd.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/thttpd.service
+endef
+
 $(eval $(autotools-package))
diff --git a/package/thttpd/thttpd.service b/package/thttpd/thttpd.service
new file mode 100644 (file)
index 0000000..e3c93e7
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Tiny HTTP Daemon
+
+[Service]
+PIDFile=/run/thttpd.pid
+ExecStart=/usr/sbin/thttpd -D -C /etc/thttpd.conf
+Restart=always
+
+[Install]
+WantedBy=multi-user.target