zsh-users
 help / color / mirror / code / Atom feed
* redirecting stdio/stderr from a suspended then bged job
@ 1999-03-11 15:54 Michael Barnes
  1999-03-11 16:28 ` Bart Schaefer
  1999-03-12  5:06 ` Geoff Wing
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Barnes @ 1999-03-11 15:54 UTC (permalink / raw)
  To: zsh-users

This has been bugging me for a while.  How can I suspend a job that is
taking longer than I expect and then put it in the background and then
redirect stdio and/or stderr to a file (or /dev/null) ?

example:

wget http://slowserver/bigfile.tgz

1% done and its been 2 minutes

^Z

zsh: 25317 suspended  wget http://slowserver/bigfile.tgz

bg %1 >/dev/null 2>&1

nope does not work that just redirects the output of bg not the job that
was bged.

Any suggestions? (besides using screen).

Michael Barnes


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

* Re: redirecting stdio/stderr from a suspended then bged job
  1999-03-11 15:54 redirecting stdio/stderr from a suspended then bged job Michael Barnes
@ 1999-03-11 16:28 ` Bart Schaefer
  1999-03-12  5:06 ` Geoff Wing
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-03-11 16:28 UTC (permalink / raw)
  To: Michael Barnes; +Cc: zsh-users

Michael Barnes writes:
 > This has been bugging me for a while.  How can I suspend a job that is
 > taking longer than I expect and then put it in the background and then
 > redirect stdio and/or stderr to a file (or /dev/null) ?

You can't.  The I/O descriptors are all established before the job is
started the first time, and then once it is running they're completely
under the control of the job itself; the shell can't change them again.

If you think about it, it has to work this way; imagine the havoc that
could be wrought if a process couldn't guarantee that all writes to the
same descriptor are going to go to the same place.

The only thing you can do is to guess what jobs might take a long time,
and redirect their output somewhere when you start them.  If that place
is a file and you later want to see some of the output, you can run
"tail -f" or whatever.

There are some tricks you could play with named pipes or the zsh coproc,
but they all require that the redirection be specified when you first
type out the command.


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

* Re: redirecting stdio/stderr from a suspended then bged job
  1999-03-11 15:54 redirecting stdio/stderr from a suspended then bged job Michael Barnes
  1999-03-11 16:28 ` Bart Schaefer
@ 1999-03-12  5:06 ` Geoff Wing
  1 sibling, 0 replies; 3+ messages in thread
From: Geoff Wing @ 1999-03-12  5:06 UTC (permalink / raw)
  To: zsh-users

Michael Barnes <mibarnes@vt.edu> typed:
:This has been bugging me for a while.  How can I suspend a job that is
:taking longer than I expect and then put it in the background and then
:redirect stdio and/or stderr to a file (or /dev/null) ?
:example:
:wget http://slowserver/bigfile.tgz
:1% done and its been 2 minutes
:^Z
:zsh: 25317 suspended  wget http://slowserver/bigfile.tgz
:bg %1 >/dev/null 2>&1
:nope does not work that just redirects the output of bg not the job that
:was bged.

You can't.  It's out of our control unless zsh was to keep running
just to keep the pipes going.

Of course, with recent wget you don't need to (if you use
the -v option) as it will automagically start writing to ``wget-log''
when it can't write to the tty any more.  Well, that's what happens
with me.  Maybe it needs another option.  BTW, the manual says it's
in -v mode by default, but without it I couldn't get it to go to
wget-log (when I tried just now).

Regards,
-- 
Geoff Wing   <gcw@pobox.com>            Mobile : (Australia) 0412 162 441
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/


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

end of thread, other threads:[~1999-03-12  5:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-11 15:54 redirecting stdio/stderr from a suspended then bged job Michael Barnes
1999-03-11 16:28 ` Bart Schaefer
1999-03-12  5:06 ` Geoff Wing

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