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

Re: Flush file contents



On Wed, Jan 07, 2004 at 03:02:30PM -0500, Kevin Mark wrote:
| On Wed, Jan 07, 2004 at 01:55:29PM -0500, Rick Pasotto wrote:
| > On Wed, Jan 07, 2004 at 12:42:33PM -0600, Rick Weinbender wrote:
| > > Is there a command to flush or empty the contents
| > > of a file?
| > > I would like the empty file to retain it's attributes and rights.
[...]

| it is also a safe thing to do to log files. If you delete a logfile,
| data will be lost. But by cp'ing and then null'ing a file you dont
| risk that.

Actually, you do risk data loss by copying and then truncating.  It is
possible for the daemon to write additional data to the log between
the time your copy completed and the truncation occurs.

If you are dealing with log files, use 'logrotate' to manage the
rotation of them.  Ideally, though, the daemon will close and reopen
the log file when rotation is performed (ie when signalled by
logrotate).

-D

-- 
If your life is a hard drive,
Christ can be your backup.
 
www: http://dman13.dyndns.org/~dman/            jabber: dman@dman13.dyndns.org

Attachment: signature.asc
Description: Digital signature


Reply to: