From a5dc7f751b5bed6148ec59a63d2428d0bf6884e5 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 21 Mar 2020 11:58:59 +0000 Subject: [PATCH] Avoid notifying from a log resource --- cookbooks/squid/recipes/default.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbooks/squid/recipes/default.rb b/cookbooks/squid/recipes/default.rb index 457228fee..3b90afcb5 100644 --- a/cookbooks/squid/recipes/default.rb +++ b/cookbooks/squid/recipes/default.rb @@ -115,9 +115,9 @@ service "squid" do subscribes :reload, "template[/etc/resolv.conf]" end -log "squid-restart" do - message "Restarting squid due to counter wraparound" - notifies :restart, "service[squid]" +service "squid-restart" do + service_name "squid" + action :restart only_if do IO.popen(["squidclient", "--host=127.0.0.1", "--port=3128", "mgr:counters"]) do |io| io.each.grep(/^[a-z][a-z_.]+ = -[0-9]+$/).count.positive? -- 2.39.5