LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-18-2013, 08:24 AM   #1
pallaviArora
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Rep: Reputation: Disabled
Smile reseting the contents of a file after reaching its maximum size


contents of the file need be reset as soon as it reaches it's maximum size suppose 10 mb,how can we do so in unix/linux..i need the complete script for it.thanks in advance ppl.
 
Old 11-18-2013, 08:57 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Quote:
Originally Posted by pallaviArora View Post
contents of the file need be reset as soon as it reaches it's maximum size suppose 10 mb,how can we do so in unix/linux..i need the complete script for it.thanks in advance ppl.
- You mention "the file", is this one specific file or are there more?
- Does this need to be checked continuously or on-demand?
- Does "reset" mean make empty or delete?
- What have you tried and where do you get stuck?
 
Old 11-18-2013, 09:15 AM   #3
pallaviArora
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
its a log file,need to empty the contents of that log file.
 
Old 11-18-2013, 09:17 AM   #4
pallaviArora
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
its a log file,we need to reset i.e empty the contents of that log file,need to check it continously as soon as it reaches its maximum size,should be automatically reset.thanks in advance.

Last edited by pallaviArora; 11-18-2013 at 09:20 AM.
 
Old 11-18-2013, 09:28 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Quote:
Originally Posted by pallaviArora View Post
its a log file,we need to reset i.e empty the contents of that log file,need to check it continously as soon as it reaches its maximum size,should be automatically reset.thanks in advance.
Most distro's come with logrotate. Have a look at these links:
- logrotate
- HowTo: The Ultimate Logrotate Command Tutorial with 10 Examples

File(s) can be rotated on a time interval (day, week, month) and/or a size. This is done on a daily base from crontab.

Doing this continuously might get you into trouble (what if the file is written to at the same moment it is truncated).
 
Old 11-18-2013, 09:43 AM   #6
pallaviArora
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
thanks a lot..
 
Old 11-18-2013, 10:22 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
You're welcome.

Can you put up the [SOLVED] tag.
- above the first post -> Please Mark this thread as solved if you feel a solution has been provided.
- -or- -
- first post -> Thread Tools -> Mark this thread as solved
 
  


Reply


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
[SOLVED] maximum filename lenth and maximum file size snjksh Linux - Newbie 5 07-22-2013 01:34 AM
squid cache_dir hard disk space reaching the maximum size sohailkmu Linux - Newbie 1 01-20-2010 10:35 AM
Which File consuming maximum Size??? linuxshadow Linux - Server 2 06-13-2008 03:24 AM
Maximum file size Hiran Joseph Programming 7 11-24-2006 08:54 AM
avisync maximum file size david.skinner Linux - Software 0 11-26-2004 06:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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