powerflash

Active Member
Nov 1, 2004
34
0
156
I must remove the logs file from /etc/httpd/domlogs every week ... like must I config the crontab??.. what are the command?? ... rm??

Thanks
Alessio
 

JayPee

Member
Mar 2, 2004
8
0
151
Coimbatore, India
Hi,

After logged your server through SSH with root privilege, follow the given steps to clear the domain logs every sunday.

step1:

vi /root/clear_log.sh


cd /usr/local/apache/domlogs
for i in $( ls )
echo > $i
done


#Note: press "Esc" key and type :wq and presss "enter" key to save the above contents.


step2:

chmod 700 /root/clear_log.sh



step3:

vi /var/spool/cron/root

#Note: add the following line at the bottom of this file.

* * * * 0 sh /root/clear_log.sh

#Note: press "

Esc" key and type :wq and presss "enter" key to save the above contents

.
 

asmithjr

Well-Known Member
Jun 13, 2003
516
8
168
you left out the do in the script

this:
cd /usr/local/apache/domlogs
for i in $( ls )
echo > $i
done


should be:
cd /usr/local/apache/domlogs
for i in $( ls )
do
echo > $i
done
 

Jemshi

Well-Known Member
Sep 11, 2003
208
0
166
India
powerflash said:
I must remove the logs file from /etc/httpd/domlogs every week ... like must I config the crontab??.. what are the command?? ... rm??

Thanks
Alessio

Better option is to use the whm's feature of clearing the logs after stats update each day. In the other case where you clear it using some script, chances are that, it runs before stats update on that day and thus missing entries for that day in the stats.

HTH,
Jemshad O K
Bobcares
http://bobcares.com
http://poornam.com
 
Last edited:

powerflash

Active Member
Nov 1, 2004
34
0
156
in Tweak Setting/Stats and Logs:

([] Delete each domain's access logs after stats run)

it is???

Thanks
Alessio
 

powerflash

Active Member
Nov 1, 2004
34
0
156
I have the remove this line in crontab file root:

* * * * 0 sh /root/clear_log.sh



.. but I received each minute this error:

/root/clear_log.sh: /root/clear_log.sh: No such file or directory
 

Jemshi

Well-Known Member
Sep 11, 2003
208
0
166
India
powerflash said:
in Tweak Setting/Stats and Logs:

([] Delete each domain's access logs after stats run)

it is???

Thanks
Alessio
Yes. That has the additional advantage that logs wont go much larger in size and cause the stats programs (awstats, webalizer, analog etc) to choke on reading and parsing those large files. End result is, much lesser load for the server :)
 

Jemshi

Well-Known Member
Sep 11, 2003
208
0
166
India
powerflash said:
I have the remove this line in crontab file root:

* * * * 0 sh /root/clear_log.sh



.. but I received each minute this error:

/root/clear_log.sh: /root/clear_log.sh: No such file or directory
try service crond restart