apt-get install watchdog
man watchdog.conf
take look at those parameters i posted - "file =", "repair-binary =", also "test-binary =".
script for test-binary could be like this, also set "test-timeout = 60".
Code:
ls -la /my/mounted/nfs/dir >/dev/null 2>&1
ls -la will try to access directory - if it doesn't exists - watchdog will see it as fialure and normally will reboot. if dir will exists - but server wont respond - for this you set the test-timeout - if within 60 s scripts won't finish, again failure.
and now 2nd part - you dont want immediate reboot - because server can be down hour, day etc, right ? and just with the testing, your RPIs would reboot constantly in loop. so you add "repair-binary = ...."
Code:
while ! ping XXXXX; do
sleep 1
done
exit 1
so once failure (not accessible dir) happens, watchdog runs "repair" binary - there you are waiting until ping responds (you can also set an timeout). the exit 1 at the end is to "fake" to watchdog a failure while "repairing" situation - so once ping responds, script returns failure and watchdog reboots machine.
and skip google