From 9937734e509c91b9561e5183b71641eea3093a75 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 23 Apr 2019 14:41:42 -0700 Subject: [PATCH] terminate-psql-sessions: Only terminate if we have permissions. We have been semi-accidentally relying on the fact that terminate-psql-sessions fails silently when there are PIDs we don't have permission to terminate. This actually happens somewhat often, generally when we're doing a series of operations in quick succession by different users, because postgres processes live a little longer than the `psql` shell that started them. As part of adding ON_STOP_ERROR to all of our postgres commands, it makes sense to enforce we don't fail here, but that means we need to actually filter the target PIDs to only ones we can actually kill. Signed-off-by: Anders Kaseorg --- scripts/setup/terminate-psql-sessions | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/setup/terminate-psql-sessions b/scripts/setup/terminate-psql-sessions index c77dbc1934..e01a8b73ab 100755 --- a/scripts/setup/terminate-psql-sessions +++ b/scripts/setup/terminate-psql-sessions @@ -26,6 +26,11 @@ root) ;; esac -"${psql[@]}" <