LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron (https://www.linuxquestions.org/questions/linux-newbie-8/cron-528530/)

sanjibgupta 02-12-2007 11:40 PM

Cron
 
Hi
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

timmeke 02-13-2007 05:27 AM

Quote:

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.


All times are GMT -5. The time now is 05:24 PM.