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
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
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.