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

Resource consumption.


I'm pretty sure I have a cron job analysing apache logs which is
consuming too much of the system's resources.
So much is spent on Webalizer and Awstats that the web server stops
answering requests.

The output of `uptime` was something like 2.2 before I manually kill the
script and all is OK again.

What can I do about this ?

Here is my simple bash script:

# do webazolver
for i in /var/log/apache/access_tmp/*-access_log; do
        webazolver -N 20 -D /var/log/webazolver/dns_cache.db $i

# do webalizer
for i in /var/log/apache/access_tmp/*-access_log; do
    site=`echo $i | sed 's/\/var\/log\/apache\/access_tmp\///'`
    site=`echo $site | sed 's/-access_log//'`
    if [ -e /etc/webalizer/$site.webalizer.conf ];
        webalizer -D /var/log/webazolver/dns_cache.db -c

It just loops through the apache logs and analyzes them.
I even use 'webazolver' to try and help but still grinds down the machine.
I currently have this script fire every 4 hours. So the logs are not
too big.

I'm thinking maybe to add a `sleep 300` or something to the script.
Maybe it's better to check if one instance to Webalizer is already 
running then sleep and try again.

Any suggestions.
I have about 20 virtual sites on this box and 400 on another.

Many thanks

Reply to: