Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

It seems so "primitive" that HTTPD has to be restarted just to rotate the logs. There has got be other ways to accomplish this!

Note that I do not use nor wish to use AWStats, one of the ways to solve this problem.

Using CentOS 5.x on a dedicated server.

share|improve this question
1  
You don't need to restart apache to rotate the logs. According to this, you need only send a SIGHUP to the PID listed in the PidFile, and apache will close and reopen its logfiles. –  Steven Monday Sep 22 '11 at 15:43
    
What are you using to rotate your logs?? logrotate should take care of this for you... –  Sean Kimball Sep 22 '11 at 15:55
    
Would a reload be better than a SIGHUP ? –  Gaia Sep 22 '11 at 18:41
add comment

1 Answer

up vote 6 down vote accepted

No need to restart, reload is enough:

/sbin/service httpd reload > /dev/null 2>/dev/null || true
share|improve this answer
    
I have "/etc/rc.d/init.d/httpd graceful ; sleep 5" Can I just replace it with the line above? –  Gaia Sep 22 '11 at 18:40
    
reload send a HUP signal to the process. graceful, as its mean, doesn't terminate the currently open connections. A side effect is the old log files will not be closed immediately. –  quanta Sep 23 '11 at 2:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.