On October 14, 2025 9:40:45 PM UTC, David Barsky <[email protected]> wrote: >> If testing is all scripted, then why not put "pg_ctl stop" at the end of >the script? > >Sorry for the delay. > >It’s _mostly_ scripted, but two major reasons: > >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. bash has EXIT trap you can use to run functions even in the case of interrupts; You can create a wrapper script if its not written in bash. 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. You could also run pg_ctl stop in the background (i.e. in another process). Again, if using bash, you just add & at the end. It should be possible to create processes in any scripting language.
- Re: Option on `postgres` CLI to shutdown when... Tom Lane
- Re: Option on `postgres` CLI to shutdown ... Dominique Devienne
- Re: Option on `postgres` CLI to shutd... Ron Johnson
- Re: Option on `postgres` CLI to ... Dominique Devienne
- Re: Option on `postgres` CLI to ... Tom Lane
- Re: Option on `postgres` CLI to ... Dominique Devienne
- Re: Option on `postgres` CLI to ... David Barsky
- Re: Option on `postgres` CLI to ... Ron Johnson
- Re: Option on `postgres` CLI to ... David Barsky
- Re: Option on `postgres` CLI to ... Thiemo Kellner
- Re: Option on `postgres` CLI to ... Bird
- Re: Option on `postgres` CLI to ... Greg Sabino Mullane
- Re: Option on `postgres` CLI to ... Tom Lane
- Re: Option on `postgres` CLI to ... Ron Johnson
- Re: Option on `postgres` CLI to ... Dominique Devienne
- Re: Option on `postgres` CLI to shutdown when there ar... Ron Johnson
- Re: Option on `postgres` CLI to shutdown when the... Adrian Klaver
- Re: Option on `postgres` CLI to shutdown when... Ron Johnson
