Results 1 to 6 of 6
-
04-16-2011, 08:54 AM #1New Member
- Join Date
- Apr 2011
- Posts
- 3
how to delete logs and domlogs automatically
Hello .
I have a huge logs and domlogs . it takes around 10GB a week !
how to delete domlogs automatically ?
I tried to add a Cron Job like this :
rm -rf /home/apache/domlogs/*
but it's now working ..
-
04-16-2011, 02:35 PM #2Junior Guru
- Join Date
- Oct 2010
- Posts
- 219
How did you add it exactly?
Try to edit: /etc/crontab
Add at the end of the file:
02 4 * * * root rm -rf /home/apache/domlogs/*
Now restart crond
/etc/init.d/crond restart
This should delete your logs daily.
-
04-17-2011, 02:12 PM #3New Member
- Join Date
- Apr 2011
- Posts
- 2
deleting domlogs On centos
Hi,
i'm having the same problem, and i'm wondering how to delete the domlogs in centos ??
-
04-17-2011, 05:16 PM #4New Member
- Join Date
- Apr 2011
- Posts
- 3
-
04-17-2011, 05:24 PM #5New Member
- Join Date
- Apr 2011
- Posts
- 2
edit cron
use this command:
crontab -e
#press enter then insert;
02 4 * * * root rm -rf /home/apache/domlogs/*
-
04-17-2011, 05:54 PM #6Aspiring Evangelist
- Join Date
- Apr 2010
- Location
- Lansing, MI
- Posts
- 422
There are better ways to do what you're trying to do, but first a comment about what you've got so far:
Did that work for you? If you're logged in as root, that will add it to the root crontab, which should work well. However, your command might give you some errors, unless I'm missing something.
'02 4 * * * root rm -rf /home/apache/domlogs/*'
The entire entry, after the time entry (the 02 4 * * *) is the command. 'root' does not need to be there, and may (or may not) cause problems. The entry should look like this:
'02 4 * * * rm -rf /home/apache/domlogs/*
Additionally, after that removal happens you need to restart Apache. I would probably use this:
'02 4 * * * rm -rf /home/apache/domlogs/ & /etc/init.d/httpd restart*
(make sure to correct the path to wherever your apache init file is.)
You might also look here for more information on Cron http://adminschoice.com/crontab-quick-reference
HOWEVER!
Two suggestions:
1) if you're using cPanel it is a much better idea to just set the logs to be deleted after stats generation in WHM.
2) The other suggestion I have, and probably the best fit available to you: Configuring logrotate to rotate/remove the files on a regular basis is a much better way to approach it.
This might help with that one: http://www.thegeekstuff.com/2010/07/logrotate-examples/Benny Crampton
Liquid Web - Dedicated Hosting with Heroic Support
StormOnDemand - Flexible Cloud Hosting Infrastructure
1-800-580-4985 | Twitter: @liquidweb | @StormOnDemand
Similar Threads
-
how to delete domlogs?
By akasharya in forum Hosting Software and Control PanelsReplies: 3Last Post: 09-19-2010, 06:51 AM -
Domain access logs (domlogs)
By HD Fanatic in forum Hosting Security and TechnologyReplies: 0Last Post: 09-29-2005, 01:58 PM -
Delete emails after 90 days automatically
By lucid in forum Programming DiscussionReplies: 9Last Post: 11-30-2004, 06:16 PM -
How to delete a mysql record automatically?
By shwathi_a in forum Programming DiscussionReplies: 5Last Post: 07-30-2004, 01:36 AM -
How do I delete emails automatically
By SarrCom.com in forum Dedicated ServerReplies: 0Last Post: 08-25-2003, 03:35 AM