public inbox for [email protected]
help / color / mirror / Atom feedFrom: Thiemo Kellner <[email protected]>
To: [email protected]
Subject: Re: Option on `postgres` CLI to shutdown when there are no more active connections?
Date: Wed, 15 Oct 2025 07:47:34 +0200 (GMT+02:00)
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAPR5_5rvpF+vVnexG6CRoN6DNhM3RReQvuHNJC04OpgVujOArg@mail.gmail.com>
References: <CAPR5_5psNqCm1OQr5LL4v6z02Sh=2YHYUg8NY+3xMzfGHfKs+w@mail.gmail.com>
<[email protected]>
<CAPR5_5q2oCkw19rHb7oy-M0M0purWFM5Jc8ub5xDy_NdhUmRTw@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAFCRh-94eXetAjtCURs5F0JZQr=kso0rVgVSEmWiSD7wA6VcMw@mail.gmail.com>
<CANzqJaDn_mVi4M0CbKnVNwK9RxYOneoCRmd_d69rbjBrwasuPQ@mail.gmail.com>
<CAFCRh--P93bF0gpkdvg4MzMNqq5gK=4eWFkmBDR0xw9dmFVAPQ@mail.gmail.com>
<[email protected]>
<CAFCRh--_14QR1_=vZvKVZkcA_1LRO-pQd2p6BBRMreyAv2_z6w@mail.gmail.com>
<CAPR5_5rRYkM9bO=KC_PY-Bj2Fw=t+maEYG+Am-UgaCHRTWyFsg@mail.gmail.com>
<CANzqJaBepwWOdD3dOJPMx8KdHaA3xMk8NA9ST5oCK2HUoyqvig@mail.gmail.com>
<CAPR5_5rvpF+vVnexG6CRoN6DNhM3RReQvuHNJC04OpgVujOArg@mail.gmail.com>
14.10.2025 23:49:21 David Barsky <[email protected]>:
> 1. If that script is cancelled or interrupted for any reason, it’s possible that
> `pg_ctl stop` won't be called and I'd have a leaked process.
As others stated, some shells have the trapping functionality.
> I could mitigate
> this by calling `pg_ctl stop` at the *start* of the script, but that adds a
> bit of latency I'd prefer to avoid.
I wonder what the reason is to avoid that latency in the script. Spinning down the DB will take time anyway.
Would it be possible to make a procedure run at the start of the DB, like a daemon, checking for the last connection to quit if there has been one, and to shutdown the DB in an ordered manner?
Just my two Rappen
view thread (4+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Option on `postgres` CLI to shutdown when there are no more active connections?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox