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

Re: truncating files



The problem with removing and recreating is that if a program has that
file open for appending (e.g. logfiles), the file isn't actually
removed from the disk until that program closes its file descriptor.
So you end up with 3 problems:
 1. The file still exists on disk, but is not linked to in any
    directory;
 2. New log messages are sent to the phantom file, not to your newly
    created file - so you never see them; and
 3. You lose the file ownership and permissions of the original
    file.

--Bill.

In article <Pine.LNX.3.96.971207103618.3163D-100000@timshel>, Rick Macdonald <macdonal@cuug.ab.ca> writes:

> On Sun, 7 Dec 1997, Carl Mummert wrote:
>> Summary:
>> 
>> 1) > foo
>> 2) cp /dev/null foo
>> 
>> Problems:

>> 2) cp /dev/null foo won't take multiple filenames as arguments

>> So the answer is that I do need a script or program to do the job.

> What about:

> rm -f {list of filenames}
> touch {list of filenames}

> ...RickM...

> -- 
William R Ward          Bay View Consulting   http://www.bayview.com/~hermit/
hermit@bayview.com     1803 Mission St. #339        voicemail +1 408/479-4072
wrw@bayview.com       Santa Cruz CA 95060 USA           pager +1 408/458-8862


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: