Got a CentOS webserver hosting around 150 websites and each of their apache log files (access_log, error_log, combined_log) were saved separately (/var/log/site1, /var/log/site2 and so on). The previous administrator didn't setup the logrotate for these logfiles, so some were almost 15Gb of file size and delete them manually. Another thing is, the httpd are having problem restarting and even stopping the service. most of the time, it failed to stop and start which I need to do kill or killall each processes manually.
What I wish to do is to set all sites logs with logrotate monthly (4 logs + 1 current) but making sure that when the httpd (apache2) got restarted, it will surely run again.
Below is the example I found but from a debian website (http://www.debian-administration.org/articles/117
) but not sure what needs to modify to meet my requirements.
create 640 root adm
if [ -f /var/run/apache.pid ]; then
/etc/init.d/apache restart > /dev/null