The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Restart apache

Discussion in 'EasyApache' started by bjarne, Sep 8, 2004.

  1. bjarne

    bjarne Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    If you have problems with apache crashing time by time, maby this can help you.

    Add this to /etc/ crontab - change hours if it is to often for your like or not.
    If you like then remove the > /dev/null part so you get a email each time - and can monitor all is good. The output shuld say apache stoped no prosesses killed and apache started:)

    0 0 * * * root /usr/bin/apacherestart > /dev/null
    0 7 * * * root /usr/bin/apacherestart > /dev/null
    0 12 * * * root /usr/bin/apacherestart > /dev/null
    0 17 * * * root /usr/bin/apacherestart > /dev/null
    0 20 * * * root /usr/bin/apacherestart > /dev/null

    Add a file with 700 right as root to /usr/bin
    You can test the script by doing /usr/bin/apacherestart

    #!/bin/bash
    /usr/local/apache/bin/apachectl stop
    sleep 3
    killall httpd
    rm -f /usr/local/apache/logs/httpd.pid
    /usr/local/apache/bin/apachectl start
     
  2. Greedo3443

    Greedo3443 Member
    PartnerNOC

    Joined:
    Nov 18, 2002
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
Loading...

Share This Page