From 56dc1d56a00e19f7ab008f745ea72534fe9d8115 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 25 Mar 2024 13:39:13 +0100 Subject: [PATCH] Use RequiresMountsFor on datadir It is quite common for the data directory to be on its own mount. Systemd can ensure a directory is mounted before a service starts using RequiresMountsFor[1]: > Takes a space-separated list of absolute paths. Automatically adds > dependencies of type Requires= and After= for all mount units required > to access the specified path. [1]: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#RequiresMountsFor= --- templates/systemd-override.conf.epp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/systemd-override.conf.epp b/templates/systemd-override.conf.epp index 48b02c72f4..e451ce8c88 100644 --- a/templates/systemd-override.conf.epp +++ b/templates/systemd-override.conf.epp @@ -3,6 +3,9 @@ Stdlib::Absolutepath $datadir, Optional[String[1]] $extra_systemd_config, | -%> +[Unit] +RequiresMountsFor=<%= $datadir %> + [Service] Environment=PGPORT=<%= $port %> <%- if $facts['os']['family'] == 'Gentoo' { -%>