mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2026-04-21 01:10:25 +01:00
add suggested changes to send logs to stdout
Signed-off-by: edgd1er <edgd1er@hotmail.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
s6-echo "Stopping lighttpd-access-log"
|
s6-echo "Stopping lighttpd-access-log"
|
||||||
pid=$(ps -C cat -o pid=,args= |grep -oP "([0-9]+).+access\.log" |cut -f1 -d" ")
|
pid=$(ps -C cat -o pid=,args= |grep -oP "([0-9]+).+access\.log" |cut -f1 -d" ")
|
||||||
if [[ -n ${pid} ]]; then
|
if [[ -n ${pid} ]]; then
|
||||||
echo "Killing ${pid}"
|
|
||||||
kill -9 ${pid}
|
kill -9 ${pid}
|
||||||
fi
|
fi
|
||||||
s6-echo "Stopped lighttpd-access-log"
|
s6-echo "Stopped lighttpd-access-log"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
s6-echo "Redirecting FIFO access log to stdout"
|
s6-echo "Starting lighttpd-access-log"
|
||||||
|
|
||||||
s6-setuidgid www-data cat /var/log/lighttpd/access.log 2>&1
|
s6-setuidgid www-data cat /var/log/lighttpd/access.log 2>&1
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
s6-echo "Stopping lighttpd-error-log"
|
s6-echo "Stopping lighttpd-error-log"
|
||||||
pid=$(ps -C cat -o pid=,args= |grep -oP "([0-9]+).+error\.log" |cut -f1 -d" ")
|
pid=$(ps -C cat -o pid=,args= |grep -oP "([0-9]+).+error\.log" |cut -f1 -d" ")
|
||||||
if [[ -n ${pid} ]]; then
|
if [[ -n ${pid} ]]; then
|
||||||
echo "Killing ${pid}"
|
|
||||||
kill -9 ${pid}
|
kill -9 ${pid}
|
||||||
fi
|
fi
|
||||||
s6-echo "Stopped lighttpd-error-log"
|
s6-echo "Stopped lighttpd-error-log"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
s6-echo "Redirecting FIFO error log to stdout"
|
s6-echo "Starting lighttpd-error-log"
|
||||||
|
|
||||||
s6-setuidgid www-data cat /var/log/lighttpd/error.log 2>&1
|
s6-setuidgid www-data cat /var/log/lighttpd/error.log 2>&1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
s6-echo "Stopping lighttpd"
|
s6-echo "Stopping lighttpd"
|
||||||
killall -9 lighttpd
|
|
||||||
service lighttpd-access-log stop
|
service lighttpd-access-log stop
|
||||||
service lighttpd-error-log stop
|
service lighttpd-error-log stop
|
||||||
|
killall -9 lighttpd
|
||||||
|
|||||||
@@ -4,15 +4,21 @@ s6-echo "Starting lighttpd"
|
|||||||
|
|
||||||
if [[ 1 -eq ${WEBLOGS_STDOUT:-0} ]]; then
|
if [[ 1 -eq ${WEBLOGS_STDOUT:-0} ]]; then
|
||||||
#lighthttpd cannot use /dev/stdout https://redmine.lighttpd.net/issues/2731
|
#lighthttpd cannot use /dev/stdout https://redmine.lighttpd.net/issues/2731
|
||||||
rm -f /var/log/lighttpd/access.log
|
for fi in /var/log/lighttpd/access.log /var/log/lighttpd/error.log
|
||||||
mkfifo -m 600 /var/log/lighttpd/access.log
|
do
|
||||||
rm -f /var/log/lighttpd/error.log
|
if [[ ! -p ${fi} ]]; then
|
||||||
mkfifo -m 600 /var/log/lighttpd/error.log
|
rm -f ${fi}
|
||||||
|
mkfifo -m 600 ${fi}
|
||||||
|
fi
|
||||||
|
done
|
||||||
chown -R www-data:www-data /var/log/lighttpd
|
chown -R www-data:www-data /var/log/lighttpd
|
||||||
service lighttpd-access-log start
|
service lighttpd-access-log start
|
||||||
service lighttpd-error-log start
|
service lighttpd-error-log start
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
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
|
||||||
# Touch log files to ensure they exist (create if non-existing, preserve if existing)
|
# Touch log files to ensure they exist (create if non-existing, preserve if existing)
|
||||||
touch /var/log/lighttpd/access.log /var/log/lighttpd/error.log
|
touch /var/log/lighttpd/access.log /var/log/lighttpd/error.log
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user