I was getting tired of Mediatomb forgetting the videos I had seen because the NFS mount would not come back in time when the power went off. Being that it’s running on a Raspberry Pi I started digging into this new systemd for an answer. Tuns out there’s a way to make an NFS mount a dependency of the process. First thing is /etc/fstab needs to be modified to let systemd know about it. For this, it’s something like this:
127.0.0.1:/export/path /mnt/nfs_mount/ nfs ro,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
Then edit the mediatomb service file (/etc/systemd/system/multi-user.target.wants/mediatomb.service) to add the dependency in the [Unit] section.
RequiresMountsFor=/mnt/nfs_mount/
And that’s it! That was way easier than I expected.