On Wed, Apr 12, 2023 at 1:31 PM Greg Stark <st...@mit.edu> wrote: > I don't object to using the pid file as the mechanism -- but it is a > bit of an awkward UI for shell scripting. I imagine it would be handy > if pg_ctl had an option to just print the port number so you could get > it with a simple port=`pg_ctl -D <dir> status-port`
That's not a bad idea, and would provide some additional isolation to reduce direct dependency on the PID file format. However, awk 'NR==4' $PGDATA/postmaster.pid is hardly insanity. If it can be done with a 5-character awk script, it's not too hard. The kind of thing you're talking about is much more important with things like pg_control or postgresql.conf that have much more complicated formats. The format of the PID file is intentionally simple. But that's not to say that I'm objecting. -- Robert Haas EDB: http://www.enterprisedb.com