[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to properly empty log files



On Sat, 18 Oct 2008 11:47:12 +0000, Tzafrir Cohen wrote:

>> > you can "truncate" the file with the folowing bash line :
>> > > /var/log/mail.err
>> 
>> > or the following portable line :
>> > echo > /var/log/mail.err
>> 
>> Neither of those will work in this instance, as the file is held open
>> for writing. On the next write, the data will be written into the file
>> at the same place as if you hadn't truncated it (all the preceding data
>> will appear to be NULLs).
> 
> Are you sure? 

I think so, too.

> The above method works fine for me.

What exactly do you mean "works fine"? Empty the log file? Sure it will. 
Have you double checked that empty log file starts to pick new entries 
right away?

-- 
Tong (remove underscore(s) to reply)
  http://xpt.sourceforge.net/techdocs/
  http://xpt.sourceforge.net/tools/


Reply to: