I've installed PostgreSQL under Ubuntu 20.4 using the PGDG apt repository.
Each time I stop the DB server, e.g., with
sudo service postgresql stop, the log says 'received fast shutdown request', but I'd like to initiate a smart shutdown.
I can achieve this by sending a TERM signal directly to the postmaster process. However, that seems to circumvent the whole systemd infrastructure. Ideally, I guess, there should be some version of
sudo systemctl stop postgresql .... But whatever I try, it always results in a fast shutdown.
Even the less high-level commands don't perform a smart shutdown - contrary to their documentation. Among other variations, I tried
sudo pg_ctlcluster --mode smart 13 main stop sudo pg_ctlcluster 13 main stop -- --mode smart
and also editing
/etc/postgresql/13/main/pg_ctl.conf. All to no avail.
So, what's the proper systemd-conform way to perform a smart shutdown?