zsh-users
 help / color / mirror / code / Atom feed
From: Brian Harvell <harvell@aol.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>,
	ZSH Users <zsh-users@math.gatech.edu>
Subject: Re: rolling over high-traffic logfiles?
Date: Thu, 16 Jul 1998 08:46:09 -0400	[thread overview]
Message-ID: <Pine.SGI.4.00.9807160839570.2322-100000@boondoggle.office.aol.com> (raw)
In-Reply-To: <980715220851.ZM13527@candle.brasslantern.com>

> 
> } 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




  parent reply	other threads:[~1998-07-16 12:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-16  3:49 Sweth Chandramouli
1998-07-16  5:08 ` Bart Schaefer
1998-07-16  8:36   ` Zefram
1998-07-16 12:46   ` Brian Harvell [this message]
1998-07-16 15:26     ` Bart Schaefer
1998-07-16 16:14       ` Zefram
1998-07-16 16:41         ` Nitin P Garg
1998-07-17  7:36           ` Jos Backus
1998-07-24 23:42       ` Todd Graham Lewis
1998-07-16 13:45 ` Duncan Sinclair

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SGI.4.00.9807160839570.2322-100000@boondoggle.office.aol.com \
    --to=harvell@aol.net \
    --cc=schaefer@brasslantern.com \
    --cc=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).