Files
docker-pi-hole/s6/debian-root/etc/services.d/lighttpd/run
Dan Schaper 54f56a717e Remove touch from runtime init scripts
co-authored-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2022-04-01 11:45:16 -07:00

33 lines
1.2 KiB
Plaintext

#!/usr/bin/with-contenv bash
s6-echo "Starting lighttpd"
if [[ 1 -eq ${WEBLOGS_STDOUT:-0} ]]; then
#lighthttpd cannot use /dev/stdout https://redmine.lighttpd.net/issues/2731
for fi in /var/log/lighttpd/access.log /var/log/lighttpd/error.log
do
if [[ ! -p ${fi} ]]; then
rm -f ${fi}
mkfifo -m 600 ${fi}
fi
done
chown -R www-data:www-data /var/log/lighttpd
service lighttpd-access-log start
service lighttpd-error-log start
sleep 2
else
#remove fifo if exists
[[ -p /var/log/lighttpd/access.log ]] && rm -Rf /var/log/lighttpd/access.log
[[ -p /var/log/lighttpd/error.log ]] && rm -Rf /var/log/lighttpd/error.log
# install /dev/null log files to ensure they exist (create if non-existing, preserve if existing)
[[ ! -f /var/log/lighttpd/access.log ]] && install /dev/null /var/log/lighttpd/access.log
[[ ! -f /var/log/lighttpd/error.log ]] && install /dev/null /var/log/lighttpd/error.log
# Ensure that permissions are set so that lighttpd can write to the logs
chown -R www-data:www-data /var/log/lighttpd
chmod 0644 /var/log/lighttpd/access.log /var/log/lighttpd/error.log
fi
lighttpd -D -f /etc/lighttpd/lighttpd.conf