Solved

rm ubuntu schedule

Posted on 2009-07-08
4
225 Views
Last Modified: 2013-11-15
hi,

I have lots of log files in /etc/log how can we schedule/cron to have it remove files older than X numer of days?

The file is owned by root so I have to sudo su - I'm not sure how to do this..

Cheers!

0
Comment
Question by:mikesteven
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:medvedd
Comment Utility
There is a special program for this, called logrotate. Please read 'man logrotate' for details.
0
 

Author Comment

by:mikesteven
Comment Utility
can we create a script and delete files older than X number of days?
0
 

Author Comment

by:mikesteven
Comment Utility
found it , find "$DIR" -type f -mtime +$TIMEVAR -ls
0
 
LVL 16

Accepted Solution

by:
medvedd earned 500 total points
Comment Utility
For deleting files you can use:

sudo find /etc/log -mtime +X -exec rm {} \;

Put number of days instead of X
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now