From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12431 invoked from network); 16 Jul 1998 12:58:52 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Jul 1998 12:58:52 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id IAA16161; Thu, 16 Jul 1998 08:52:59 -0400 (EDT) Resent-Date: Thu, 16 Jul 1998 08:45:51 -0400 (EDT) Date: Thu, 16 Jul 1998 08:46:09 -0400 From: Brian Harvell X-Sender: harvell@boondoggle.office.aol.com To: Bart Schaefer cc: Sweth Chandramouli , ZSH Users Subject: Re: rolling over high-traffic logfiles? In-Reply-To: <980715220851.ZM13527@candle.brasslantern.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-Message-ID: <"0yDyX2.0.ov3._NVhr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1677 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > > } does anyone have any other ideas on how to not lose and log entires? > > Use "ln" and "mv" to replace the file, rather than "cp" over it. > > cp /dev/null extlog.new && > ln extlog extlog.`date` && > mv -f extlog.new extlog || > rm -f extlog.new > > There's still a race condition where some process could attempt to write > to extlog during the execution of "mv", that is, between unlinking the > old extlog and renaming extlog.new to extlog. However, the window for > failure is much smaller, and could be made smaller still by using the > "files" module with zsh 3.1.4 so that "ln" and "mv" are shell builtins. > That won't work. You are going to have to send syslog a sighup before it will release it's current file handle and reopen to a new one. All you need to do is mv the logfile to the new name. (syslog will continue to write to it even after the mv has completed) then send syslog a sighup. (It will then open a new log file) There is still a small chance that you will loose entries but that's the nature of syslog anyway. Syslogd can easily get overloaded and drop entries on the floor. Brian Brian Harvell harvell@aol.net http://boondoggle.web.aol.com/ echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc