zsh-users
 help / color / mirror / code / Atom feed
* Parallel backupping embedded systems...how?
@ 2014-12-09 18:24 meino.cramer
  2014-12-09 20:31 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: meino.cramer @ 2014-12-09 18:24 UTC (permalink / raw)
  To: zsh-users

Hi,

Currently I am experimenting with two of this little
linux systems: http://www.acmesystems.it/arietta

Since everything is changing fast I often make backups.
I nfs-mount both Ariettas to mountpoints on my PC and
tar the whole stuff.

If tar is done for both systems, I compress the resulting
archive with 7z.

Currently this is done in pure sequentiell order...and slow
therefor.

I would like to do that in parallel if possible. I thought
of gnu parallel ... But I have two different input parameter
(both mountpoints) and (more complicated) tow different output
parameter ... the names of the archives.

If I put both tar processes into background I dont know
how to wait correctly for the jobs end to start 7z.

And most important: I dont know what I dont know in this
case... ;)

What is the most "hassle free" and secure (in the sense of
"not failing") way to do what I want to acchieve with
zsh?

Thank you very much in advance for any parallel help :) ;)

Best regards,
Meino




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

* Re: Parallel backupping embedded systems...how?
  2014-12-09 18:24 Parallel backupping embedded systems...how? meino.cramer
@ 2014-12-09 20:31 ` Peter Stephenson
  2014-12-09 21:12   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2014-12-09 20:31 UTC (permalink / raw)
  To: zsh-users

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


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

* Re: Parallel backupping embedded systems...how?
  2014-12-09 20:31 ` Peter Stephenson
@ 2014-12-09 21:12   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2014-12-09 21:12 UTC (permalink / raw)
  To: zsh-users

On Tue, 9 Dec 2014 20:31:14 +0000
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> zmodload zsh/parameter
> process1 &
> process2 &
> TRAPCHLD() {
>    if (( ${#jobstates} == 0 && jobs_started )); then
>      print Last background job edited, doing something else...
>      trap -- CHLD
>    fi
> }

Sorry, remove "&& jobs_started".

This implies you're in an interactive shell with job control --- it'll
work in a function but not a script unless you "setopt monitor".

pws


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

end of thread, other threads:[~2014-12-09 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09 18:24 Parallel backupping embedded systems...how? meino.cramer
2014-12-09 20:31 ` Peter Stephenson
2014-12-09 21:12   ` Peter Stephenson

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