From 474b817baa7c4158eddce2a8c34c4498f5dd523a Mon Sep 17 00:00:00 2001 From: exu Date: Sat, 15 Jul 2023 16:32:48 +0200 Subject: [PATCH] Add how to require a systemd mount before starting a service --- pages/02.linux/systemd-automount/default.en.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pages/02.linux/systemd-automount/default.en.md b/pages/02.linux/systemd-automount/default.en.md index 70ea77b..9927a5d 100644 --- a/pages/02.linux/systemd-automount/default.en.md +++ b/pages/02.linux/systemd-automount/default.en.md @@ -47,3 +47,17 @@ WantedBy=multi-user.target Enable the `.automount` file to mount the filesystem when necessary `# systemctl enable (target-mount).automount` + +## Service - require mount + +Other services that depend on the filesystem being mounted might have issues with the built-in automounting. +In these cases, the option `RequiresMountsFor=` can be set under the `[Unit]` configuration to ensure a path is mounted. +Paths are space separated + +```systemd +[Unit] +... +RequiresMountsFor=[PATH 1] [PATH 2] +``` + +> [Systemd RequiresMountsFor documentation](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequiresMountsFor=)