I work on a laptop at the office using Remote Desktop. Occasionally I can not longer reach the host. When I physically log on to the host it appears to have disconnected from the network, rebooting the host solves the problem. I need a script/program which runs on the remote host and reboots if it loses network connectivity.
Something like this...Not asking anyone to write it, just point me in the right direction if there are already apps or scripts which do this.
if flag file exists exit (we already restarted once)
loop
loop
ping 'some other host'
if fail sleep and then try again
if fail > N times
write flag file
reboot
fi
fi
end loop
sleep for a while
end loop
Of course... you could try resolving the root cause of the problem:
Allow the computer to turn off this device to save power
See if that works.