Automatic Apache Restart Script

Discussion in 'Apache' started by joker2040, Sep 21, 2007.

  1. #1
    Does anyone know of a script that will check apache every so many minutes and if it's down will automatically restart it? Apache keeps crashing on my server and I don't know why. If you restart it is fine but it might die again within the next 24hrs. Until I can sort this out I need a script to restart it for me. Any ideas?
     
    joker2040, Sep 21, 2007 IP
  2. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #2
    can you post some error logs here? maybe I can help you with apache crashing issues.
     
    gibex, Sep 21, 2007 IP
  3. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    tanfwc, Sep 21, 2007 IP
  4. joker2040

    joker2040 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Oh my I just looked and it appears that the error_log file is 226mb. I guess I'm looking at the right one. It's under /etc/httpd/logs.

    WHM/CPanel is installed on the server.
     
    joker2040, Sep 21, 2007 IP
  5. joker2040

    joker2040 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There is a bunch of this

    Then some of this

    and

     
    joker2040, Sep 21, 2007 IP
  6. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I would suggest checking the plugs, there might be something wrong with some of the apache install.
     
    powerspike, Sep 21, 2007 IP
  7. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yeah something with ur installation got wrong. But funny that you ask for a script to restart it rather than how to fix it that it won't crash.
     
    evera, Sep 21, 2007 IP
  8. joker2040

    joker2040 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    LOL.... yeah I figured it would be easier to install a script as a temporary work around until I could actually solve the problem. So where do I go from here? It has been fine for several months and just started doing this recently since I added on a couple more vbulletin sites.
     
    joker2040, Sep 22, 2007 IP
  9. ma0

    ma0 Peon

    Messages:
    218
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    if you are under linux you can use
    /etc/init.d/apache2 restart
    and call it every hour with cron
     
    ma0, Sep 24, 2007 IP
  10. Scriptona

    Scriptona Notable Member

    Messages:
    4,957
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    280
    #10
    How is your memory usage ?

    Take snapshots of memory usage every 1 hour in peak hours ( 6 am to 6 pm) as possible and see if you are running out of memory

    This causes apache to crash
     
    Scriptona, Sep 30, 2007 IP