From 49ddd9fe3e177131a50994e4a69fd3a6bbcb6d03 Mon Sep 17 00:00:00 2001 From: thelittlefireman Date: Fri, 7 Apr 2017 09:43:19 +0200 Subject: [PATCH] Prevent config files from being filled to infinity When you start/stop Successively your container, the file /root/.ssh/conf and /usr/local/etc/php-fpm.conf grow to infinity : loop repetition of line "; Include one or more files. If glob(3) exists, it is used to include a bunch of ; files from a glob(3) pattern. This directive can be used everywhere in the ; file. ; Relative path can also be used. They will be prefixed by: ; - the global prefix if it's been set (-p argument) ; - /usr/local otherwise include=etc/php-fpm.d/*.conf php_flag[display_errors] = off php_flag[display_errors] = off php_flag[display_errors] = off php_flag[display_errors] = off php_flag[display_errors] = off" --- scripts/start.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/start.sh b/scripts/start.sh index 30095d1..4d4a91d 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -3,6 +3,10 @@ # Disable Strict Host checking for non interactive git clones mkdir -p -m 0700 /root/.ssh +# Prevent config files from being filled to infinity by force of stop and restart the container +echo "" > /root/.ssh/config +/usr/local/etc/php-fpm.conf + echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config if [[ "$GIT_USE_SSH" == "1" ]] ; then @@ -75,6 +79,13 @@ if [ -f /var/www/html/conf/nginx/nginx-site-ssl.conf ]; then cp /var/www/html/conf/nginx/nginx-site-ssl.conf /etc/nginx/sites-available/default-ssl.conf fi + +# Prevent config files from being filled to infinity by force of stop and restart the container +lastlinephpconf="$(grep "." ./run_example.sh | tail -1)" +if [[ $lastlinephpconf == *"php_flag[display_errors]"* ]]; then + sed '$' /usr/local/etc/php-fpm.conf +fi + # Display PHP error's or not if [[ "$ERRORS" != "1" ]] ; then echo php_flag[display_errors] = off >> /usr/local/etc/php-fpm.conf