Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

      ping 'some other host'
      if fail sleep and then try again
         if fail > N times
            write flag file
    end loop
    sleep for a while
end loop
share|improve this question
Suddenly I have images of pencils taped to CD trays. I don't have answers for you, just two pieces of advice. Be as certain as you possibly can be that the host use choose for "some other host" isn't going to go away. Also, if this happens routinely you will need some kind of process to reap your flag file after some period of time, otherwise you're solution will work once and then never work again. – Catherine MacInnes Nov 16 '09 at 22:03
This is just a machine I use to work on. It is an old laptop. I understand what your saying but this design will work fine for me, perhaps an adjustment or two would need to be made, but we have servers on the network with 99% uptime. – Ethan Post Nov 16 '09 at 22:41

Of course... you could try resolving the root cause of the problem:

  • Device Manager
  • Network Adapters
  • Properties of the problem LAN adapter
  • Power Management tab
  • Uncheck Allow the computer to turn off this device to save power

See if that works.

share|improve this answer
Will take a look but for an old laptop that runs 24*7 my guess is I won't find the problem and the script above should be easier to write even if I end up needing to write it myself in DOS. Just trying to save myself a drive into work now and then. – Ethan Post Nov 16 '09 at 22:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.