Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Reboot a server automatically if it runs out of resources


    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!!


  2. #2
    Linux Newbie arespi's Avatar
    Join Date
    May 2011
    Monterrey , Mexico
    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

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Fairfax, VA
    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.

  4. $spacer_open
  5. #4
    Linux Engineer
    Join Date
    Apr 2012
    Virginia, USA
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts