X-Git-Url: https://iankelling.org/git/?p=log-quiet;a=blobdiff_plain;f=sysd-prom-fail;fp=sysd-prom-fail;h=ea84f7490797b670d4579a724ec926382c999112;hp=20e7c9b588cf69c17ca57fda652232934a064b0c;hb=559cd04634ae77a27b830c811c38f240993c1775;hpb=c95baa6003490dcbbda39f5b6340ab68ba121224 diff --git a/sysd-prom-fail b/sysd-prom-fail index 20e7c9b..ea84f74 100755 --- a/sysd-prom-fail +++ b/sysd-prom-fail @@ -66,8 +66,17 @@ fi if $write_count; then printf 'node_systemd_unit_result_fail_count{name="%s"} %s\n' "$ser_name" "$count" >$ftmp mv $ftmp $f + finaltmp=$dir/sysd-result-fail.prom.$$ + # i had a minor problem that multiple of these scripts executed at the same time, and ended up with + # multiple instances of the same file + # ls -lai + # ... + # 3896242 -rw-r--r-- 1 root root 439 Apr 4 00:02 sysd-result-fail.prom + # 3896242 -rw-r--r-- 1 root root 439 Apr 4 00:02 sysd-result-fail.prom + # 3896242 -rw-r--r-- 1 root root 439 Apr 4 00:02 sysd-result-fail.prom + # this seems harmless, https://www.spinics.net/lists/linux-btrfs/msg111245.html + # however, lets do a bit to avoid it: sleep a random amount of time from 0-.5 seconds. + sleep 0.$(( RANDOM % 500 )) + cat $dir/*-result-fail.premerge >$finaltmp + mv $finaltmp $dir/sysd-result-fail.prom fi - -finaltmp=$dir/sysd-result-fail.prom.$$ -cat $dir/*-result-fail.premerge >$finaltmp -mv $finaltmp $dir/sysd-result-fail.prom