]> git.openstreetmap.org Git - chef.git/commitdiff
squid: use different exec_start based on ubuntu release
authorGrant Slater <git@firefishy.com>
Fri, 7 Aug 2020 00:33:19 +0000 (01:33 +0100)
committerGrant Slater <git@firefishy.com>
Fri, 7 Aug 2020 00:33:19 +0000 (01:33 +0100)
cookbooks/squid/recipes/default.rb
cookbooks/squid/templates/default/squid.conf.erb

index fbfc1daef97c6c8262bb9151d941bf7e3c5cfab6..37352b2c9bd42d555ea6859f59db81bdda693a0c 100644 (file)
@@ -98,6 +98,12 @@ file "/etc/logrotate.d/squid.dpkg-dist" do
   action :delete
 end
 
+squid_service_exec = if node[:lsb][:release].to_f < 20.04
+                       "/usr/sbin/squid -YC"
+                     else
+                       "/usr/sbin/squid --foreground -sYC"
+                     end
+
 systemd_service "squid" do
   dropin "chef"
   limit_nofile 98304
@@ -107,7 +113,7 @@ systemd_service "squid" do
   protect_home true
   restrict_address_families address_families
   restart "always"
-  exec_start "/usr/sbin/squid --foreground -YC"
+  exec_start "#{squid_service_exec}"
 end
 
 # Quick hack to cleanup bloated journal
index 3a74a6c12fd1d88ed91730029e5d12182bc09355..61008078a70535764f4182fc363e90afdf3f0bf9 100644 (file)
@@ -10,7 +10,7 @@ workers <%= [ node[:cpu][:total] - 2, 1 ].max.ceil %>
 cpu_affinity_map process_numbers=<%= (1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %> cores=<%=(1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %>
 
 # Set short clean shutdown interval
-shutdown_lifetime 10 seconds
+shutdown_lifetime 2 seconds
 
 error_log_languages off
 <% end -%>