Why Send HUP signal after rotating log files

I've lighttpd and Apache installed and every Sunday night log files get archived and rotated. However, I'm not sure why we need to send HUP single after archiving log files:
Code:
/lighttpd/var/log/example.com/error_log      644  5     *   D0 Z0 /var/run/lighttpd.pid HUP
 
cos the now moved/gone/archived log file will still be open and being written to (and will keep filling your partition until you close all references to said file, like say, by HUPing lighttpd) and the new log file will remain nicely empty
 
Mind you, this is only necessary for logfiles not created and written by syslogd. So if you have an application that can log using syslogd (e.g. BIND has an option for that, and applications like e.g. Sendmail and Dovecot do it by default), there's no need to HUP that application. Newsyslog will signal syslogd when rotating logfiles.

But if you're using newsyslog to rotate a logfile that's being written outside of syslogd (in other words: by the application itself), the writing application needs to be signalled in order to close the active file descriptor and open a new one to a new logfile. Or else the active file descriptor will simply move with the logfile being rotated and continue writing to it.
 
Thanks for info. I've always blindly sent a HUP, but this Apache document recommends sending a SIGUSR1, not a HUP:
http://httpd.apache.org/docs/2.2/stopping.html

Quoting from above url:
The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.
 
Back
Top