diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2024-03-16 18:33:00 -0400 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-05-06 17:32:16 +0100 |
commit | c31dd78225219d808259cd4ee04d25ba8a1142de (patch) | |
tree | bbd985e195531139dfe94911ee03eb5b4e5716af /www-servers/lighttpd/files/lighttpd.initd-r2 | |
parent | sys-apps/pcsc-lite: enable py3.12 (diff) | |
download | gentoo-c31dd78225219d808259cd4ee04d25ba8a1142de.tar.gz gentoo-c31dd78225219d808259cd4ee04d25ba8a1142de.tar.bz2 gentoo-c31dd78225219d808259cd4ee04d25ba8a1142de.zip |
www-servers/lighttpd: update lighttpd.initd, lighttpd.service
* test configs with -tt for a better preflight config test.
* graceful restart using SIGUSR1
[sam: I've rebased this to fork the changes into a new ebuild revision
(1.4.75-r1). Any errors in rebasing are mine and not Glenn's.]
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'www-servers/lighttpd/files/lighttpd.initd-r2')
-rw-r--r-- | www-servers/lighttpd/files/lighttpd.initd-r2 | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/www-servers/lighttpd/files/lighttpd.initd-r2 b/www-servers/lighttpd/files/lighttpd.initd-r2 new file mode 100644 index 000000000000..24539e3e80c7 --- /dev/null +++ b/www-servers/lighttpd/files/lighttpd.initd-r2 @@ -0,0 +1,76 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload graceful" + +LIGHTTPD_PID="$($(which lighttpd) -pf ${LIGHTTPD_CONF} | grep server.pid-file | cut -d '=' -f 2 | tr -d \\\" | tr -d [:space:])" + +depend() { + need net + use mysql logger spawn-fcgi ldap slapd netmount dns + after famd + after sshd +} + +checkconfig() { + if [ ! -f "${LIGHTTPD_CONF}" ] ; then + ewarn "${LIGHTTPD_CONF} does not exist." + return 1 + fi + + if [ -z "${LIGHTTPD_PID}" ] ; then + eerror "server.pid-file variable in ${LIGHTTPD_CONF}" + eerror "is not set. Please set this variable properly" + eerror "and try again" + return 1 + fi + /usr/sbin/lighttpd -tt -f ${LIGHTTPD_CONF} >/dev/null +} + +start() { + checkconfig || return 1 + # Glean lighttpd's credentials from the configuration file + # Fixes bug 454366 + LIGHTTPD_USER="$(awk '/^server.username/{s=$3};{sub("\"","",s)};END{print s}' ${LIGHTTPD_CONF})" + LIGHTTPD_GROUP="$(awk '/^server.groupname/{s=$3};{sub("\"","",s)};END{print s}' ${LIGHTTPD_CONF})" + checkpath -d -q -m 0750 -o "${LIGHTTPD_USER}":"${LIGHTTPD_GROUP}" /run/lighttpd/ + + ebegin "Starting lighttpd" + start-stop-daemon --start --quiet --exec /usr/sbin/lighttpd \ + --pidfile "${LIGHTTPD_PID}" -- -f "${LIGHTTPD_CONF}" + eend $? +} + +stop() { + local rv=0 + ebegin "Stopping lighttpd" + start-stop-daemon --stop --quiet --pidfile "${LIGHTTPD_PID}" + eend $? +} + +reload() { + if ! service_started "${SVCNAME}" ; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || return 1 + + ebegin "Re-opening lighttpd log files" + start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \ + --signal HUP + eend $? +} + +graceful() { + if ! service_started "${SVCNAME}" ; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || return 1 + + ebegin "Gracefully restarting lighttpd" + start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \ + --signal USR1 + eend $? +} |