Hello,

On Jun 6, Andreas Jellinghaus wrote
> can someone explain to me the background, why daemons (some, not all)
> are SIGHUP'ed or restarted, after their log files are rotated and what
> happends in the daemons code (what has to happen).

If you rename a file which is open, then writes to that open filedescriptor
will still go to the old file. This means after "mv logfile logfile.0" 
"lofile.0" will still grow. After close/open the writes will of coursego to
"logfile". If you write to a deleted file, then the writes will get lost.
(In fact the file will grow and occupy space on the disk, but there is no
dir entry for it).

The "move;create empty;reopen" of logfiles is atomar. Eighter the text will
go to the old or the new file, but no logdata will get los. If you copy the
logfile and truncate it to zero, then entries might get lost after the copy
has finished and the the truncation has started. A application which writes
logfiles should do 2 things: "write in append mode" "provide method to
close/open the log filedescriptor. (or use syslog).

Greetings
Bernd
-- 
  (OO)      -- [EMAIL PROTECTED] --
 ( .. )  [EMAIL PROTECTED],linux.de,debian.org} http://home.pages.de/~eckes/
  o--o     *plush*  2048/93600EFD  [EMAIL PROTECTED]  +4972573817  BE5-RIPE
(O____O)       If privacy is outlawed only Outlaws have privacy


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .

Reply via email to