Просмотр исходного кода

Fixing duplicate of lines in 01_caching_pool.conf

Anton Reutov 8 лет назад
Родитель
Сommit
e856134c8e
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      install/debian/8/templates/web/nginx/caching.sh

+ 10 - 4
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