diff mbox

thttpd: add systemd service file

Message ID 1426795074-9129-1-git-send-email-mike@mikebwilliams.com
State Superseded
Headers show

Commit Message

Mike Williams March 19, 2015, 7:57 p.m. UTC
Based on Arch service file, adjust to point to /usr/sbin.

Signed-off-by: Mike Williams <mike@mikebwilliams.com>
---
 package/thttpd/thttpd.mk      |  5 +++++
 package/thttpd/thttpd.service | 10 ++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 package/thttpd/thttpd.service

Comments

Samuel Martin March 20, 2015, 10:22 a.m. UTC | #1
Hi Mike,

On Thu, Mar 19, 2015 at 8:57 PM, Mike Williams <mike@mikebwilliams.com> wrote:
> Based on Arch service file, adjust to point to /usr/sbin.
>
> Signed-off-by: Mike Williams <mike@mikebwilliams.com>
> ---
>  package/thttpd/thttpd.mk      |  5 +++++
>  package/thttpd/thttpd.service | 10 ++++++++++
>  2 files changed, 15 insertions(+)
>  create mode 100644 package/thttpd/thttpd.service
>
> diff --git a/package/thttpd/thttpd.mk b/package/thttpd/thttpd.mk
> index 1a028c8..565ade6 100644
> --- a/package/thttpd/thttpd.mk
> +++ b/package/thttpd/thttpd.mk
> @@ -44,4 +44,9 @@ 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
> +       ln -fs /usr/lib/systemd/system/thttpd.service $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/thttpd.service
Please wrap these long lines.

Regards,
Thomas Petazzoni March 20, 2015, 1:24 p.m. UTC | #2
Dear Mike Williams,

On Thu, 19 Mar 2015 15:57:54 -0400, Mike Williams wrote:
> Based on Arch service file, adjust to point to /usr/sbin.
> 
> Signed-off-by: Mike Williams <mike@mikebwilliams.com>
> ---
>  package/thttpd/thttpd.mk      |  5 +++++
>  package/thttpd/thttpd.service | 10 ++++++++++
>  2 files changed, 15 insertions(+)
>  create mode 100644 package/thttpd/thttpd.service

Since this assumes we install systemd unit files in /usr/lib, could you
take this patch as part of your "RFC: systemd and service files
cleanup" series?

See my question about this series related to symbolic links (absolute
vs. relative), and adapt this patch as well accordingly.

Thanks a lot!

Thomas
diff mbox

Patch

diff --git a/package/thttpd/thttpd.mk b/package/thttpd/thttpd.mk
index 1a028c8..565ade6 100644
--- a/package/thttpd/thttpd.mk
+++ b/package/thttpd/thttpd.mk
@@ -44,4 +44,9 @@  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
+	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
index 0000000..e3c93e7
--- /dev/null
+++ b/package/thttpd/thttpd.service
@@ -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