Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Just a quick question – my server is running at my house serving webpages at http://www.javawag.com/. The problem is that my home internet connection keeps dropping randomly - for about 10 minutes at a time. This is only an intermittent problem and will go away soon I hope. However, my server doesn't recover properly - when the connection comes back, I can still access it at 192.168.0.8 (locally) without any issue, but at http://www.javawag.com/ there's no reply.

(Just an aside - my home internet connection is dynamic ISP, the domain www.javawag.com points to javawag.dyndns.org which in turn points to my IP, updated every minute by ddclient on the server).

Is there some way for the server to check if it's accessible from the outside world periodically, and if not restart Apache/reboot? Oh, and if I reboot the problem fixes itself also!

share|improve this question

migrated from serverfault.com Feb 21 '11 at 14:59

This question came from our site for system and network administrators.

3 Answers 3

You need to figure out what the actual problem is first... it sounds like your dynamic dns client isn't updating correctly after the connection is restored? You also do not state if the server is accessable by IP or another protocol and if it's only the web server part that's down? (voted to move to superuser)

share|improve this answer
    
that could be the case actually! i didnt even think of that - ddclient runs as a daemon but i can run it in command line too as a one off thing... so i can try that next time it goes down. the rest of the server is fine and accessible on 192.168.0.8 from within my network. even the web server part actually! –  Javawag Feb 20 '11 at 15:52
    
+1, might also be his client has the old IP cached... –  Chris S Feb 20 '11 at 15:58

Hm well fixing things with reboot is not really a solution I think, nor is it needed here.

I'd say if your server can reach outside world, outside world can reach you too. You can put a cronjob to check if you can ping google every 5 min, and if not try to reset the network connection if you have some dialup PPP connection for DSL/cable or whatever.

share|improve this answer
    
couldn't agree more, i'm just used to the "reboot and fix" approach when all else fails :P that's a point! next time it goes down ill do a ping www.google.com and see what happens! –  Javawag Feb 20 '11 at 15:50

You could try using an external site like http://www.downforeveryoneorjustme.com and parse the output to see if your site is accessible or not. Be "polite" and don't check continuously...every 5 minutes should be fine.

You could also look into using an external monitoring service like Mon.Itor.Us but the problem here would be how to signal your site to restart if it is down or unavailable. If the issue is the server's network connection then you would want a solution that is entirely server side.

I would also try to figure out what the ultimate cause of the outages are. Since you appear to have a dynamic IP address I would see if it happens when that changes or even when DHCP updates happen on the server. If that is the cause then you can write a script to restart Apache when that happens.

share|improve this answer
    
yeah, later when people aren't using it, i'll try taking the internet connection down on purpose and check some stuff on the server :) –  Javawag Feb 20 '11 at 15:50

Your Answer

 
discard

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.