From c1d9ba18c5af93dbec497c24082f8866c3b8cab5 Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Wed, 3 Apr 2024 22:55:34 +0200 Subject: [PATCH] Fix tail yelling about non-existent log files. --- php/Dockerfile | 1 + php/nginx/logs-phpfpm-error.finish | 2 +- php/nginx/logs-phpfpm-error.runit | 8 +------- php/nginx/php-fpm.runit | 2 ++ 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/php/Dockerfile b/php/Dockerfile index 34cd256..a3f0e93 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -177,6 +177,7 @@ RUN apt-get -qq update && \ sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/nginx/sites-enabled/default && \ sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/nginx/sites-enabled/default-ssl && \ sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/service/php-fpm/run && \ + sed -i "s/{{PHP}}/$PHP_VERSION/g" /etc/service/logs-phpfpm-error/run && \ # Enable PHP-FPM status & PHP-FPM ping sed -i -e "s|;pm.status_path =.*|pm.status_path = /fpm-status|g" /etc/php/*/fpm/pool.d/www.conf && \ sed -i -e "s|;ping.path =.*|ping.path = /fpm-ping|g" /etc/php/*/fpm/pool.d/www.conf && \ diff --git a/php/nginx/logs-phpfpm-error.finish b/php/nginx/logs-phpfpm-error.finish index eb34c8c..1441ce3 100644 --- a/php/nginx/logs-phpfpm-error.finish +++ b/php/nginx/logs-phpfpm-error.finish @@ -1,2 +1,2 @@ #!/usr/bin/env bash -sleep 1 +sleep 5 diff --git a/php/nginx/logs-phpfpm-error.runit b/php/nginx/logs-phpfpm-error.runit index 1560ca5..f7c4bbc 100644 --- a/php/nginx/logs-phpfpm-error.runit +++ b/php/nginx/logs-phpfpm-error.runit @@ -1,8 +1,2 @@ #!/usr/bin/env bash -# for each php-fpm log file, tail it -# if there are no php-fpm log files, sleep for a second -for i in /var/log/php*-fpm.log; do - if [[ -f ${i} ]]; then - tail -f "${i}" & - fi -done +tail -f /var/log/php{{PHP}}-fpm.log diff --git a/php/nginx/php-fpm.runit b/php/nginx/php-fpm.runit index 84b5246..b25b248 100755 --- a/php/nginx/php-fpm.runit +++ b/php/nginx/php-fpm.runit @@ -1,5 +1,7 @@ #!/usr/bin/env bash +touch /var/log/php{{PHP}}-fpm.log + # Load envs into PHP-fpm's env.conf. # shellcheck disable=SC1083,SC2312 env | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" >/etc/php/{{PHP}}/fpm/conf.d/env.conf