From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12827 invoked by alias); 9 Dec 2014 20:31:35 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19514 Received: (qmail 25784 invoked from network); 9 Dec 2014 20:31:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [86.6.25.230] X-Spam: 0 X-Authority: v=2.1 cv=RdIeCjdv c=1 sm=1 tr=0 a=c0CwWhpM9oUd/BnC3z6Gzg==:117 a=c0CwWhpM9oUd/BnC3z6Gzg==:17 a=NLZqzBF-AAAA:8 a=kj9zAlcOel0A:10 a=f94BLoiIT-s6MgvBN7wA:9 a=CjuIK1q_8ugA:10 Date: Tue, 9 Dec 2014 20:31:14 +0000 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: Parallel backupping embedded systems...how? Message-ID: <20141209203114.470e80ff@pws-pc.ntlworld.com> In-Reply-To: <20141209182415.GB4483@solfire> References: <20141209182415.GB4483@solfire> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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