systemd unit file dependency on file systems being mounted?
Tom H
tomh0665 at gmail.com
Sat Aug 15 17:46:57 UTC 2020
On Sat, Aug 15, 2020 at 6:41 PM Peter Silva <peter at bsqt.homeip.net> wrote:
>
> I have an an application that has as systemd unit file.. it runs a
> bunch of daemons, that we only want starting up after the network and
> all file systems are mounted. Some file systems might be NFS
> mounted... I don't know... this is a generic unit file installed with
> the package. How does one generically express a dependency on "all
> file systems normally mounted during boot are available?"
>
> I currently have:
>
> After=network.target
>
> I figure perhaps:
>
> After=network.target local-fs.target remote-fs.target
>
> If there are no remote file systems configured will the remote-fs
> target be satisfied, or will it just refuse to start?
If you add "_netdev" to the fstab options of your nfs mounts, these
mounts'll be added to the "remote-fs.target" unit and "After=...
remote-fs.target" in your deamons' service units'll order your daemons
after the mounts.
Otherwise, systemd has a "RequiresMountsFor" directive for a list of
space-separated mount points that a service unit has to depend on.
More information about the ubuntu-users
mailing list