Results 1 to 4 of 4
Hey,
I am stuck a little bit with the following problem:
My web server is running stable for most of the time. Although it happens that occasionally it is no ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-11-2012 #1Just Joined!
- Join Date
- Mar 2012
- Posts
- 18
Reboot a server automatically if it runs out of resources
Hey,
I am stuck a little bit with the following problem:
My web server is running stable for most of the time. Although it happens that occasionally it is no longer reachable via SSH and Apache is not available neither.
My theory is that the server is running out of resources in such situations and the ssh and apache demon are killed by the kernel.
A reboot fixes the issue.
I am wondering if there is a way to reboot my server automatically in case that event happens (for example it is no longer available via ssh) in order to avoid downtimes.
Thanks a lot!!
Cheers
- 06-13-2012 #2
Hi, just an idea:
You could make a small bash script that checks for the ssh and apache services status and put it in your servers crontab , and upon their results launch the reboot. If your server freezes beyond some services down, like a kernel panic or something like that this may not work.
Good luck
- 07-26-2012 #3Just Joined!
- Join Date
- Aug 2007
- Location
- Fairfax, VA
- Posts
- 22
No offense but that is not the linux way! If it crashes and hangs, there *must* be a reason! Can you log on locally? Anything in the logs? There is a utility called kdump to catch kernel crashes. Sorry I've had a few drinks, but I'd highly suggest trying to figure out what the issue is, linux doesn't just run out of resources and hang, this isn't windows.
- 07-26-2012 #4Linux Enthusiast
- Join Date
- Apr 2012
- Location
- Virginia, USA
- Posts
- 561
There is no reliable way to do this. If the server is so overloaded that it hangs, then your script is not going to execute either. What you need to do is figure out what's crashing your server, and fix it.


Reply With Quote
