Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Looking for log files with open file handles in linux.

by jpl (Monk)
on Jul 14, 2011 at 09:26 UTC ( #914301=note: print w/replies, xml ) Need Help??

in reply to Looking for log files with open file handles in linux.

If you delete via unlink (as opposed to truncation, for example) and roll via rename (not by copying), you may not have to worry. If you unlink a file that another process is reading, the file will continue to exist until the other process closes the file. This is the basis for an old trick of opening, then unlinking, a file, so it will "disappear" even if the machine crashes. The file can be written and read using the open file handle, even though it has no visible presence in the file system. Similarly, a file that is being appended to by another process can safely be renamed within the file system. The open file is "known" by its inode number, not by the name by which it was opened, and the inode number is unaltered by a local rename.

Don't rely on atime. Many, perhaps most, linux file systems no longer maintain it.

  • Comment on Re: Looking for log files with open file handles in linux.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://914301]
[Discipulus]: choroba the Tk client print out an educated error message that it cant connect..
[Discipulus]: Can't connect to 80Invalid argument at ..perl5.26.64bit/ perl/vendor/lib/ LWP/Protocol/http. pm line 46, <__ANONIO__> line 34500.
[Corion]: Discipulus: That's weird, but maybe one of the machines is still wonky. I haven't looked :-/

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-10-24 10:51 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (288 votes). Check out past polls.