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

Re: [cobalt-users] Log Clearup



I use this little script, which could easily be modified to zero the files instead of deleting them.

#!/bin/bash

# by William Brillinger, March 27, 2003
# clear all logs for each site

for URL in $( find /home/sites -type l -maxdepth 1 | sed -e 's/\/home\/sites\///g' ); do
        echo --Removing logs for $URL...
        ls -lah /home/sites/$URL/logs
        rm /home/sites/$URL/logs/*
        echo
done

echo Completed


NOTE: this is actually one line:
for URL in $( find /home/sites -type l -maxdepth 1 | sed -e 's/\/home\/sites\///g' ); do

Cheers,
- Bill

At 07:13 PM 01/06/03 -0700, you wrote:
I use the following on the first of each month to
clear-out all the cache and stats files from all the
sites on the server.. You can safely delete the .stats
and .cache files if you want -they'll just get
recreated the next time reports run..

rm /home/sites/site*/logs/web.cache*
rm /home/sites/site*/logs/web.stats
rm /home/sites/site*/logs/ftp.cache*
rm /home/sites/site*/logs/ftp.stats
rm /home/sites/site*/logs/mail.cache*
rm /home/sites/site*/logs/mail.stats

I also visit each sites' log folder every three months
and zero the .log files as well (as some of them grow
to be quite large).. I don't actually delete the .log
files, instead I just zero them using the following
commands:

(followed by Ctrl-D to escape)

cat > web.log
Ctrl-D

cat > ftp.log
Ctrl-D

cat > mail.log
Ctrl-D

That will set each .log file back to zero and leave
the file intact.. The .cache and .stats files can be
deleted..  Hope that helps..

Barbara


---------------------------------
William J.A. Brillinger
Precision Design Co.

E-Mail:   mailto:billy@xxxxxxxxxx
Web site: http://www.pdcweb.net