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

Re: Apache in chroot jail - Log rotation.



On Tue, Dec 20, 2005 at 10:52:34AM +1000, Michael Bellears wrote:
> When logrotate rotates the apache logs
> (/var/chroot/apache/var/log/apache/), it appears to not be able to
> stop/start apache, therefore there is no further logging performed until
> I manually stop then start apache (/etc/init.d/apache stop then
> /etc/init.d/apache start)

Are you sure? logrotate moves the access.log file to access.log.1. If
apache is not stopped, then it should continue to log to the file
descriptor that it has open, even though it has been renamed.  next time
logrotate kicks in and gzips the .1 file, then apache will stop logging.

> Any suggestions as to what I can use in the /etc/logrotate.d/apache
> script to stop then start apache?

Add cron and logrotate into your chroot and do the rotation internally.

> Should the line:
> 
> if [ -f /var/run/apache.pid ]; then \
> 
> Be:
> if [ -f /var/chroot/apache/var/run/apache.pid ]; then \
> 
> As that is where the apache.pid file is actually located?

Yup - that's at least one change you should make.

-- 
Jon Dowland
http://alcopop.org/



Reply to: