1

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?

1
  • Write a drop-in service file that changes the way systemd shuts down PostgreSQL. Feb 21, 2022 at 20:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.