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.

Reload apache after httpd.conf change

Discussion in 'EasyApache' started by tata13, Oct 30, 2008.

  1. tata13

    tata13 Active Member

    Joined:
    Feb 8, 2006
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Jakarta
    Hi

    I am using loadbalancing and have second apache web server.The only problem is every time I make a change to the httpd.conf or if i add a new virtualhost, I have to restart Apache in other server.Is there a way to configure Apache such that every time a change is made to these configuration files, it reloads or reinitializes to take care of these changes?

    Thanks
     
  2. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    I would assume you could write a script that checks the size of the httpd.conf and if it changes then restart apache, maybe in a cron that runs every 5 minutes or so.
     
  3. tata13

    tata13 Active Member

    Joined:
    Feb 8, 2006
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Jakarta
    Thanks, just create script to compare file and put it in cronjob

    Code:
    #!/bin/bash
    # RHEL / CentOS / Fedora Linux reload command
    RELOAD="/sbin/service httpd reload"
    HOME="/etc/httpd/conf"
    #
    if ( cmp -s $HOME/file1 $HOME/file2 ) ; then
    #
       #echo files match
    #
    else
    #
      #echo files do not match
        sleep 10
        $RELOAD
    #
    fi
    
     
  4. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    What in the world?
     
  5. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
Loading...

Share This Page