From 550fe7daa3010cd3fa9a6b267d0566d192946205 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 29 Feb 2024 07:38:06 +0800 Subject: [PATCH] Make bootstrap collectd restart conditional - only restart if the config file changes --- docker-compose/start-loadbalancer.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker-compose/start-loadbalancer.sh b/docker-compose/start-loadbalancer.sh index b847bccb..32d5c152 100755 --- a/docker-compose/start-loadbalancer.sh +++ b/docker-compose/start-loadbalancer.sh @@ -20,7 +20,8 @@ ipvsadm -A -t ${EXTIP}:8080 -s rr docker compose up -d -CF=/etc/collectd/collectd.conf.d/curl_json.conf +CF=/etc/collectd/collectd.conf.d/curl_json.conf.new +CF_LIVE=/etc/collectd/collectd.conf.d/curl_json.conf echo "LoadPlugin curl_json" > $CF echo "" >> $CF @@ -60,6 +61,10 @@ for i in `seq 1 $THREADS`; do EOF done echo "" >> $CF -systemctl restart collectd + +if ! cmp -s $CF $CF_LIVE; then + mv $CF $CF_LIVE + systemctl restart collectd +fi ipvsadm -l -n