OK, I will try to provide soome building blocks in the hope you can build something out of it.
First we must be sure that your
wol <macaddress>
does work at all. You only say that you can’t get it working from boot.local, but you do not tell that it works on it’s own. When you can not wol, that will be the end of the exercise.
Then we first must be sure we have can predict what happens at boot, I assume you have an entry in /etc/fstab for this mount. I also assume you do not have the noauto parameter there. I suggest to add the nofail parameter. The result should be that when the NFS server is available the mount will happen at boot and when it is not available there will be no delay in the boot process.
Then we need a script to check what the situation is and to do those things that are missing. IMHO there are two things to test here: is the mount done and when not, is the NFS server alive.
There are several ways you could test if the fsis mounted, my preference is to have a file in the unmounted mountpoint. This can be created e.g.
umount /mnt/media
touch not-mounted
mount /mnt/media
I use /mnt/media as the mount point here. I assume you are able to replace this with your own mount point.
Then we want to make a bash script. I would put that in /root/bin (the bin directory inside the home directory of root). In this example I will give the script the name nasmount. After the script is created (you can use the editor of your choice as root), you have to do
chmod u+x /root/bin/nasmount
to make this script executable.
#!/bin/bash
# First we test if the mount is present
-a /mnt/media/not-mounted ]] && mount /mnt/media
# If still not mounted the NAS maybe asleep
if -a /mnt//media/not-mounted ]]
then
wol <macaddress>
sleep 2m
mount /mnt/media
fi
This waits 2 minutes for the NAS to boot to full functionality. You can change that of course to your reality.
Then we can make an entry in the crontab of root. Use
crontab -e
and add
-*/1 * * * * /root/bin/nasmount >/dev/null 2>&1
This will run every minute, but the overhead is almost nil.