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 have ubuntu server that has some services that only come back after loosing internet for an extended period of time with a reboot. Does anyone have a script that can reboot server if lose internet for like 2 hours? Thanks.

share|improve this question

closed as off-topic by Jenny D, Falcon Momot, Bryan, Ward, mdpc Jul 15 '13 at 4:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here, but can be asked on Stack Overflow." – Jenny D, mdpc
If this question can be reworded to fit the rules in the help center, please edit the question.

what are you trying to achieve by rebooting the server? is it supposed to bring the connectivity back up? rebooting the server just for that reason alone seems unnecessary. Just referring to any computer (specially the one you can reboot on a whim) in your question as a "server" does not automatically make such question a good fit for SF – Alex P. Jul 14 '13 at 16:37
You should fix the service and explain what service you are talking about. Rebooting your server just because certain service does not work is pointless. – val0x00ff Jul 14 '13 at 16:38
up vote 1 down vote accepted

You can use the watchdog daemon. It allows you to define a custom command to test whether the server should reboot (or execute a different repair binary). That command will be a script that tests whether Internet connection has been up for the past two hours (for instance, you can run a script on cron that pings an external server and stores the date and time of the last successful ping). See the man page for configuration details.

share|improve this answer

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