zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: Parallel backupping embedded systems...how?
Date: Tue, 9 Dec 2014 20:31:14 +0000	[thread overview]
Message-ID: <20141209203114.470e80ff@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20141209182415.GB4483@solfire>

On Tue, 9 Dec 2014 19:24:15 +0100
meino.cramer@gmx.de wrote:
> If I put both tar processes into background I dont know
> how to wait correctly for the jobs end to start 7z.

If you have the fix in 33531 this is easy.  However, that's after 5.0.7.

process1 &
pid1=$!
process2 &
pid2=$!
wait $pid1
wait $pid2

It doesn't matter if they finish in the wrong order since the shell
remembers the status.

It's less easy before that, but you could use a SIGCHLD trap and the
$jobstates variable from zsh/parameter:


zmodload zsh/parameter
process1 &
process2 &
TRAPCHLD() {
   if (( ${#jobstates} == 0 && jobs_started )); then
     print Last background job edited, doing something else...
     trap -- CHLD
   fi
}


pws


  reply	other threads:[~2014-12-09 20:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 18:24 meino.cramer
2014-12-09 20:31 ` Peter Stephenson [this message]
2014-12-09 21:12   ` Peter Stephenson

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=20141209203114.470e80ff@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /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).