Re: Option on `postgres` CLI to shutdown when there are no more active connections?

Поиск
Список
Период
Сортировка
От Thiemo Kellner
Тема Re: Option on `postgres` CLI to shutdown when there are no more active connections?
Дата
Msg-id 235dd027-1685-4ce6-9b77-293ae6bba16b@gelassene-pferde.biz
обсуждение исходный текст
Ответ на Re: Option on `postgres` CLI to shutdown when there are no more active connections?  (David Barsky <me@davidbarsky.com>)
Список pgsql-general
14.10.2025 23:49:21 David Barsky <me@davidbarsky.com>:

> 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
quitif there has been one, and to shutdown the DB in an ordered manner? 

Just my two Rappen



В списке pgsql-general по дате отправления: