Under Ubuntu 14.04, I have developed a program in C++ that writes to an NFSv4 volume mounted by autofs.
The program works fine when my machine has already "warmed up".
However, it crashes when it's started as a service at boot time - I wrote a script for it under /etc/init.d and enabled it via update-rc.d.
Upon examining the core dump, I see that it failed to create a file under the NFSv4 volume. In fact, I can reproduce the problem even in the terminal, if I launch the program quickly enough right after reboot.
How can I ensure that autofs and nfs are ready before my service starts?
I have already added $network and autofs to the Required-Start clause of my init script, but it looks like that's not enough. It also has nothing to do with hostname resolution because the IP address of the NFS server is specified in the autofs rule.
$remote_fsas a required-start. – meuh Sep 30 '16 at 19:47service --status-all. It's a SysV init script. – Kal Oct 3 '16 at 4:14autofsis started withupstartbecause there is a/etc/init/autofs.conffile as well. If you start with SysV you can just add the name of your service to theRequired-Startsection, then disable and reenable your service. – Thomas Oct 3 '16 at 8:41