3

I am trying to set up a systemd service on Debian 8 to run a program from the network on startup but it does not work - the service starts before mounting NFS disks have completed. I have the following setup:

# cat /etc/auto.master | grep -v "#"
+dir:/etc/auto.master.d
+auto.master
/fs-1  /etc/auto.fs-1

# cat /etc/auto.fs-1
shared   -nosuid,nodev   fs-1:/shared

ls -l / | grep shared
lrwxrwxrwx   1 root root    12 Oct 19 14:33 build -> /fs-1/shared

# cat /usr/lib/systemd/system/psr_25.service
[Unit]
Description=PSR 2.5 Server
Wants=network.target network-online.target autofs.target
After=network.target network-online.target autofs.target
RequiresMountsFor=/shared/psr/25/bin

[Service]
Type=forking
User=testuser

ExecStart=/shared/psr/25/bin/server

TimeoutSec=300
[Install]
WantedBy=multi-user.target

How to make the service start after /shared has mounted?

2
  • 1
    Answerers might want to see unix.stackexchange.com/questions/246935 for some hints.
    – JdeBP
    Commented Dec 13, 2015 at 16:25
  • Isn't it kind of philosophically contradictory to want both filesystems to be mounted only when accessed and at the same time being automatically mounted at start? Why using automounting if they are mounted automatically at each start? I would remove the automounting part and then just create standard /etc/fstab entries and let systemd mount those at boot. Commented Jul 11, 2018 at 18:55

0

You must log in to answer this question.

Browse other questions tagged .