Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-13-2007, 12:40 AM   #1
Registered: Apr 2003
Location: Kolkata
Posts: 215

Rep: Reputation: 30

Yesterday I had my /var and / full. I saw it was due to the maillog being very very big.
How can i set a cron job so that if any file is over 1GB to mail me the name and size of the file with location in my email address
and how do i delete that file automatically.
If it cannot be done as soon as it reaches 1GB size. Can the the cron do this once a day.
Please tell me how do the crontab shell
Sanjib gupta
Old 02-13-2007, 06:27 AM   #2
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
if any file is over 1GB
I don't recommend this kind of automatic deletion of random files that reach 1GB in size, as it might
inadvertently delete important files.

If you want to limit this deletion to only your maillog (or similar logs), please look at
"man logrotate".

If you do insist on detecting 1GB files using cron, try using a "find" command, with "-size" option and run that from cron.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM
Slackware's Cron Scheduler: I'm thinking maybe I need to put in a different cron? Old_Fogie Slackware 5 11-03-2006 07:25 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 03:30 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:08 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration