* Bret Hughes ([EMAIL PROTECTED]) wrote:
> There appears to be a copy and truncate functions that never acually
> closes or deletes the file.  The man page talks about it being there for
> programs that cannot be restarted.  That is what prompted my question. 
> I have not had a chance to try it yet though.  Probably try to get to it
> next week.
> 
> I was wondering how the file handle thing worked.  I deleted the file
> and it did disappear from ls but the shell the jre was running in did
> not crash and I am wondering why not.

Part of the way the unix file system standard works is that a file is
not removed from the disk until all programs have finished with it. An
unlink()ed file hangs around until all apps have close()ed it.

> Makes sense if the file is not
> really gone and the shell is still writing to it.  Any ideas how to tell
> what file handles a program has via the OS?

All logrotate needs to do is copy the log to another file and truncate
it by open()ing it with in "write but don't append mode".

The file is truncated safely. The delay between the end of the copy
and the truncate is so small that its very unlikely you would lose
even one character of output under heavy load.

Tom.
-- 
            .-------------------------------------------------------.
    .^.     | Tom Gilbert, England | [EMAIL PROTECTED] |
    /V\     |----------------------| www.tomgilbert.freeserve.co.uk |
   // \\    | Sites I recommend:   `--------------------------------|
  /(   )\   | www.freshmeat.net www.enlightenment.org slashdot.org  |
   ^^-^^    `-------------------------------------------------------'


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to