Bob Proulx grabbed a keyboard and wrote:
> 
> In the future instead of removing a file that you want to be freed
> immediately consider truncating it instead.  By truncating the file it
> does not matter if there are other handles to it.  The filesystem will
> immediately free the storage associated with it.  The running syslogd
> in this case will continue to write to the same file handle.
> 
>   root@example:~# : >/var/log/syslog
> 
> I use ":" (aka "true") because historically a file redirection without
> a command associated with it was not guaranteed portable.  Probably
> doesn't matter today.  Just one of my quirks now.

Didn't know about that one (or that : by itself is a reference to TRUE).
 Good info!  When I've needed to truncate a file, I've always just done a:

cp /dev/null {file-to-be-truncated}

which works nicely. :-)

           --Dave


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to