how to restart apache automatic .

Discussion in 'Apache' started by tarekfathey, Jan 16, 2013.

  1. #1
    how to restart apache automatic every 12 hours ?
     
    tarekfathey, Jan 16, 2013 IP
  2. tarekfathey

    tarekfathey Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    any solution please ?
     
    tarekfathey, Jan 16, 2013 IP
  3. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #3
    You could set up a Cronjob like so:

    0 0,12 * * * /etc/init.d/httpd restart
     
    zacharooni, Jan 16, 2013 IP
  4. Deltahost

    Deltahost Well-Known Member

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Better make gracefull restart. Apache will wait till conection finishes and close it, then restart (when all connections will be closed). Otherwise it will terminate all connections.

    To make graceful restart - edit your /etc/crontab and add this line:

     
    Deltahost, Jan 23, 2013 IP
  5. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #5
    @Deltahost,

    graceful and restart are grouped in the same case statement in the Apache init.d script, so either will work.

    
    case $ARGV in
    start|stop|restart|graceful|graceful-stop)
        $HTTPD -k $ARGV -DSSL
        ERROR=$?
        ;;
    
    Code (markup):
     
    zacharooni, Jan 24, 2013 IP
  6. Deltahost

    Deltahost Well-Known Member

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    108
    #6
    The same case, but ARGV passed to httpd binary is different ;) And behavior of httpd will be different :)
     
    Deltahost, Jan 24, 2013 IP