On Mar 7, 2006, at 4:48 PM, Brandon S. Darbro wrote:
I've run into this many times on Linux and I've finally decided I
would
like to know why.
If I truncate a logfile, say snmpd.log, with say:
cat /dev/null > /var/log/snmp/snmpd.log
It will result in a file size of 0 bytes... but the very next time
the
process that holds it open write data to it, boom, the file is huge
again. The head of the file will be nulls until it reaches the new
data
at the end.
Why is this? On other unix's, when I zero a file, it grows slowly
back
up from zero... not jumping back up to it's previous size and then
appending.
cat /dev/null seems a very weird way to erase the file. I've always
used
: > /var/log/snmp/snmpd.log
which has never given me trouble. Come to think of it it sure does
seem like cat /dev/null should work, since it returns EOF on read.
Hunh. Dunno. Try using the colon and redirect instead, though.
Adam
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390