From e856134c8ef591fde1cba48dea8ad380f0d6912a Mon Sep 17 00:00:00 2001 From: Anton Reutov Date: Sat, 13 May 2017 21:41:34 +0200 Subject: [PATCH] Fixing duplicate of lines in 01_caching_pool.conf --- install/debian/8/templates/web/nginx/caching.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/install/debian/8/templates/web/nginx/caching.sh b/install/debian/8/templates/web/nginx/caching.sh index 6eb9126db..118e7b381 100755 --- a/install/debian/8/templates/web/nginx/caching.sh +++ b/install/debian/8/templates/web/nginx/caching.sh @@ -6,7 +6,13 @@ ip=$3 home=$4 docroot=$5 -str="proxy_cache_path /var/cache/nginx/$domain levels=2" -str="$str keys_zone=$domain:10m inactive=60m max_size=512m;" -echo "$str" >> /etc/nginx/conf.d/01_caching_pool.conf - +str="proxy_cache_path /var/cache/nginx/$domain levels=2" +str="$str keys_zone=$domain:10m inactive=60m max_size=512m;" +conf='/etc/nginx/conf.d/01_caching_pool.conf' +if [ -e "$conf" ]; then + if [ -z "$(grep "=${domain}:" $conf)" ]; then + echo "$str" >> $conf + fi +else + echo "$str" >> $conf +fi