zsh-users
 help / color / mirror / code / Atom feed
* Re: Redirection + flush?
@ 1999-01-26 17:39 Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-01-26 17:39 UTC (permalink / raw)
  To: Vincent Lefevre, zsh-users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Redirection + flush?
@ 1999-01-26 17:09 Vincent Lefevre
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Lefevre @ 1999-01-26 17:09 UTC (permalink / raw)
  To: zsh-users

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?

-- 
Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr> - PhD stud. in Computer Science
Web: http://www.ens-lyon.fr/~vlefevre/ - 100% validated HTML - Acorn Risc PC,
Yellow Pig 17, Championnat International des Jeux Mathematiques et Logiques,
TETRHEX, Faits divers insolites, etc...


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-01-26 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-26 17:39 Redirection + flush? Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1999-01-26 17:09 Vincent Lefevre

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).