[PATCH] better systemd integration

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] better systemd integration
Date: 2015-11-17 14:08:05
Message-ID: 564B34C5.7030209@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I have written a couple of patches to improve the integration of the
postgres daemon with systemd.

The setup that is shipped with Red Hat- and Debian-family packages at
the moment is just an imitation of the old shell scripts, relying on
polling by pg_ctl for readiness, with various custom pieces of
complexity for handling custom port numbers and such.

In the first patch, my proposal is to use sd_notify() calls from
libsystemd to notify the systemd daemon directly when startup is
completed. This is the recommended low-overhead solution that is now
being adopted by many other server packages. It allows us to cut out
pg_ctl completely from the startup configuration and makes the startup
configuration manageable by non-wizards. An example is included in the

The second patch improves integration with the system journal managed by
systemd. This is a facility that captures a daemon's standard output
and error and records it in configurable places, including syslog. The
patch adds a new log_destination that is like stderr but marks up the
output so that systemd knows the severity. With that in place, users
can choose to do away with the postgres log file management and let
systemd do it.

The third patch is technically unrelated but arose while I was working
on this. It improves error reporting when the data directory is missing.

Attachment Content-Type Size
0001-Add-support-for-systemd-service-notifications.patch application/x-patch 8.2 KB
0002-Add-log_destination-systemd.patch application/x-patch 6.3 KB
0003-Improve-error-reporting-when-location-specified-by-p.patch application/x-patch 1.7 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-11-17 14:43:03 Re: Bug in numeric multiplication
Previous Message Amit Kapila 2015-11-17 13:41:28 Re: Speed up Clog Access by increasing CLOG buffers