Apache in chroot jail - Log rotation.
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)
Any suggestions as to what I can use in the /etc/logrotate.d/apache
script to stop then start apache?
/var/chroot/apache/var/log/apache/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 755 root adm
sharedscripts
postrotate
if [ -f /var/run/apache.pid ]; then \
if [ -x /usr/sbin/invoke-rc.d ]; then \
/etc/init.d/apache stop > /dev/null; \
sleep 4; \
/etc/init.d/apache start > /dev/null; \
sleep 4; \
else \
/etc/init.d/apache stop > /dev/null; \
sleep 4; \
/etc/init.d/apache start > /dev/null; \
sleep 4; \
fi; \
fi;
endscript
olddir /root/apache_logs
}
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?
Regards,
MB
Reply to: