zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr>, zsh-users@sunsite.auc.dk
Subject: Re: Redirection + flush?
Date: Tue, 26 Jan 1999 09:39:54 -0800	[thread overview]
Message-ID: <990126093954.ZM24046@candle.brasslantern.com> (raw)

On Jan 26,  6:09pm, Vincent Lefevre wrote:
} Subject: Redirection + flush?
}
} I have several programs running on several machines and I want
} to redirect the error messages (from stderr) to a single file
} client.err via NFS with "2>>". Is there a way to ask zsh to do
} what need be so that the data are not corrupted?

The short answer is, no.  Once zsh opens the file descriptor and passes
it as the command's standard error, what the command does with it is
completely out of zsh's control.

The longer answer is that it's nearly impossible to do what you ask in
any case.  Unless the NFS filesystems are mounted with both the "hard"
and "sync" options, you have no hope of correctly interleaving output
from several different machines.  Even with those options set, NFS is
not a reliable protocol for multiple simultaneous writers.  (Some would
say it's not reliable for any kind of write, but ....)

If you have to do this anyway, your best bet would be to use process
redirction:

	command 2>>(tee -a sharedfile > /dev/null)

because "tee" has the kind of output-flushing behavior that you want.
(Some versions of "cat" have an option to force continuous flushing,
and I think GNU cat does so by default, so you might be able to use
that instead of tee.)

Even better would be if you could do something like:

	command 2>>(rsh nfshost "tee -a sharedfile > /dev/null")

That is, run the "tee" commands directly on the host where the file is
local, so that NFS is not involved in the write.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


             reply	other threads:[~1999-01-26 17:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-26 17:39 Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-01-26 17:09 Vincent Lefevre

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=990126093954.ZM24046@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=Vincent.Lefevre@ens-lyon.fr \
    --cc=zsh-users@sunsite.auc.dk \
    /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).