lighttpd: use procd-based init.d script 4423/head
authorPhilip Prindeville <philipp@redfish-solutions.com>
Thu, 1 Jun 2017 23:04:00 +0000 (17:04 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Fri, 2 Jun 2017 02:12:58 +0000 (20:12 -0600)
This will allow procd to restart the service if it crashes or otherwise
exits.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
net/lighttpd/Makefile
net/lighttpd/files/lighttpd.init

index 37094af8a7dccbafe56f6db61e13e5be368091e5..4e6d79fcdd90a96c4ccd7339d5f77c716c8ec39a 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lighttpd
 PKG_VERSION:=1.4.45
-PKG_RELEASE:=3
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://download.lighttpd.net/lighttpd/releases-1.4.x
index 8f3a4db6042a0f13d3be50873d677c051ce91de5..d1dfec8f839ac6c97d744ba3f6f2415327d4d3f3 100644 (file)
@@ -1,26 +1,30 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2006-2011 OpenWrt.org
 
-SERVICE_USE_PID=1
-
 START=50
+STOP=50
+
+USE_PROCD=1
+PROG=/usr/sbin/lighttpd
 
-start() {
+validate_conf() {
+       $PROG -tt -f /etc/lighttpd/lighttpd.conf >/dev/null 2>&1 || {
+               echo "validation failed"
+               return 1
+       }
+}
+
+start_service() {
        user_exists http || user_add http
        [ -d /var/log/lighttpd ] || {
                mkdir -m 0775 -p /var/log/lighttpd
                chgrp www-data /var/log/lighttpd
        }
-       service_start /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
-}
 
-stop() {
-       service_stop /usr/sbin/lighttpd
-}
+       validate_conf || exit 1
 
-restart() {
-       /usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf || exit 1
-       stop
-       start
+       procd_open_instance
+       procd_set_param command $PROG -D -f /etc/lighttpd/lighttpd.conf
+       procd_close_instance
 }