[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Apache logrotate configuration



Why doesn't the logrotate script use apachectl?

Apache
(http://httpd.apache.org/docs/2.0/logs.html#rotation)
recommends that `apache2ctl graceful` be issued after
rotating the logs.  I have a password protected ssl
cert and if I issue `apache2ctl graceful` I can do an
unattended restart of the apache2 server.  I have to
log in otherwise.  Also, apache says doing it this way
won't kill any open connections.

This is my new logrotate.d/apache2 file:
/var/log/apache2/*.log {
	weekly
	missingok
	rotate 52
	compress
	delaycompress
	notifempty
	create 640 root adm
	sharedscripts
	postrotate
		if [ -f /var/run/apache2.pid ]; then
			/usr/sbin/apache2ctl graceful
		fi
	endscript
}

The only caveat is you have to wait until connections
are closed before moving the files around.  Is this
why debian doesn't do this?  It seems that using
apache2ctl graceful would violate the assumption of
total restart or error made by the apache_stop()
routine in /etc/init.d/apache2.

Also, the use in the debian package of the
'delaycompress' option presupposes that the
connections wouldn't be closed.  So it looks like
everything would work fine.

Give it a shot.

Chris


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Reply to: