Make bootstrap collectd restart conditional

- only restart if the config file changes
This commit is contained in:
Peter Šurda 2024-02-29 07:38:06 +08:00
parent 664e57db37
commit 550fe7daa3
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95

View File

@ -20,7 +20,8 @@ ipvsadm -A -t ${EXTIP}:8080 -s rr
docker compose up -d 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 "LoadPlugin curl_json" > $CF
echo "<Plugin curl_json>" >> $CF echo "<Plugin curl_json>" >> $CF
@ -60,6 +61,10 @@ for i in `seq 1 $THREADS`; do
EOF EOF
done done
echo "</Plugin>" >> $CF echo "</Plugin>" >> $CF
if ! cmp -s $CF $CF_LIVE; then
mv $CF $CF_LIVE
systemctl restart collectd systemctl restart collectd
fi
ipvsadm -l -n ipvsadm -l -n