Add Restart=on-failure To Example Systemd File

From: Andrew Jackson <andrewjackson947(at)gmail(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Add Restart=on-failure To Example Systemd File
Date: 2025-11-27 18:55:11
Message-ID: CAKK5BkFfMpAQnv8CLs=i=rZwurtCV_gmfRb0uZi-V+d6wcryqg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Hi,

Currently the systemd file in the documentation does not specify a
restart policy. By default systemd will not attempt to restart a
service that has failed (killed by OOM-killer for example) [0]. The
systemd docs recommends "Setting this to on-failure is the recommended
choice for long-running services, in order to increase reliability by
attempting automatic recovery from errors." I think that Postgres is
probably a good example of a "long-running service". Pgbouncer for
example also uses "Restart=on-failure" [1].

Wondering also if there are any factors that I am not considering
here. Perhaps if this is the case that this is not good blanket
guidance, it would be worth it to provide some guidance around Restart
systemd parameter in the postgres docs.

[0] https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html
[1] https://github.com/pgbouncer/pgbouncer/blob/master/etc/pgbouncer.service

Thanks,
Andrew Jackson

Attachment Content-Type Size
0001-doc-Add-restart-on-failure-to-example-systemd-file.patch text/x-patch 1.2 KB

Browse pgsql-docs by date

  From Date Subject
Next Message Bernice Southey 2025-11-29 22:45:45 Re: More guidance on ctid
Previous Message Laurenz Albe 2025-11-27 13:49:48 Re: (docs): add missing info about ShareLocks