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.

link|improve this question

70% accept rate
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
feedback

1 Answer

up vote 5 down vote accepted

No need to restart, reload is enough:

/sbin/service httpd reload > /dev/null 2>/dev/null || true
link|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
feedback

Your Answer

 
or
required, but never shown

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