projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Install ca-certificates in the buildd chroots
[mirror/dsa-puppet.git]
/
modules
/
postgres
/
files
/
dsa-restart-all-idle-postgres
diff --git
a/modules/postgres/files/dsa-restart-all-idle-postgres
b/modules/postgres/files/dsa-restart-all-idle-postgres
index
38fe23e
..
078d500
100755
(executable)
--- a/
modules/postgres/files/dsa-restart-all-idle-postgres
+++ b/
modules/postgres/files/dsa-restart-all-idle-postgres
@@
-3,7
+3,8
@@
# Written by Peter Palfrader
# Based on code by Tollef Fog Heen <tfheen@err.no> based on code by Peter Palfrader
#
# Written by Peter Palfrader
# Based on code by Tollef Fog Heen <tfheen@err.no> based on code by Peter Palfrader
#
-# Restart all postgresql clusters when they do not have connections to them.
+# Restart all postgresql clusters that show up in dsa-check-libs when they do
+# not have connections to them.
set -e
set -u
set -e
set -u
@@
-45,9
+46,14
@@
handle_cluster() {
systemctl restart "postgresql@${version}-${name}.service"
}
systemctl restart "postgresql@${version}-${name}.service"
}
+tmpfile="$(tempfile)"
+trap "rm -f '$tmpfile'" EXIT
+/usr/lib/nagios/plugins/dsa-check-libs > "$tmpfile" || true
+
pg_lsclusters -h | while read version name port status; do
echo "$status" | grep -q --word-regexp online || continue
pg_lsclusters -h | while read version name port status; do
echo "$status" | grep -q --word-regexp online || continue
- handle_cluster $version $name $port &
-
don
e
+ pid="$(get_pidfile_value "$version" "$name")"
+
grep -q --word-regexp $pid "$tmpfile" || continu
e
-wait
+ handle_cluster $version $name $port
+done