Charles,
I don't know how logrotate does, but this scheme would lose data if (on
a busy system) the process is actively writing to the log file in the
moment of the 'rotate' action.
>From the moment you have made a copy until you truncate the contents of
the file, a number of lines (and/or part of a line (shiver)) may have
been written to the log file. They would all get lost.
I repeat: I don't know how logrotate does it.
But I hope it's something more secure.
Best regards
Gustav
Charles Galpin wrote:
>
> I've been reading this thread with much interest. It was my understanding
> that you can safely do
>
> cat /dev/null > file
>
> and not destroy the inode, so why can't logrotate (or anything
> else) simply do
>
> cp file file.1
> cat /dev/null > file
>
> as a rotation scheme without restarting or signaling the process that is
> writing to the file?
>
> thanks
> charles
>
> On Wed, 19 Jan 2000, Bret Hughes 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. 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?
> >
> > Bret
> >
> > Steve Borho wrote:
> > >
> > >
> > > >From what I understand, logrotate depends on the ability to either restart
> > > the daemon writing to the file, or being able to send it a signal to tell
> > > it to re-open it's file handles.
> > >
> > > The way Unix works is if a process is writing to a file, even if you delete
> > > it, the file doesn't go away until the process closes the file.
--
pgp = Pretty Good Privacy.
To get my public pgp key, send an e-mail to: [EMAIL PROTECTED]
Visit my web site at http://www.schaffter.com
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.