lighttpd: use procd-based init.d script

This will allow procd to restart the service if it crashes or otherwise
exits.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
Philip Prindeville
2017-06-01 17:04:00 -06:00
parent 63d1cbd899
commit 79f9f1a3ec
2 changed files with 19 additions and 15 deletions
+18 -14
View File
@@ -1,26 +1,30 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
SERVICE_USE_PID=1
START=50
STOP=50
start() {
USE_PROCD=1
PROG=/usr/sbin/lighttpd
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
}
restart() {
/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf || exit 1
stop
start
validate_conf || exit 1
procd_open_instance
procd_set_param command $PROG -D -f /etc/lighttpd/lighttpd.conf
procd_close_instance
}