public inbox for gentoo-user-de@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Hendrik Jürgens" <h.juergens@gmx.net>
To: gentoo-user-de@lists.gentoo.org
Subject: Re: [gentoo-user-de] Re: Bash-Skript Frage
Date: Sat, 20 Aug 2005 12:39:48 +0200	[thread overview]
Message-ID: <43070874.7080507@gmx.net> (raw)
In-Reply-To: <43070027.3030204@vr-web.de>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas Schweikle wrote:
> Nils Andresen schrieb:
> 
>>Moin,
>>
>>Volker Katz wrote:
>>
>>
>>>Also in der Art:
>>>
>>>/bin/job1 &
>>>/bin/job2 &
>>>/bin/job3 &
>>>while (not job1 finished && not job2 finished && not job3 finished)
>>>/bin/job4
>>> 
>>>
>>
>>Macht
>>( /bin/job1 & /bin/job2 & /bin/job3 ) && /bin/job4
>>nicht das ?!
> 
> 
> Nein, macht es nicht:
> - job 1 wird im Background ausgeführt
> - job 2 wird im Background ausgeführt
> - job 3 wird im Vordergrund ausgeführt
> nach *erfolgreichem* beenden von job 3 wird job 4 ausgeführt.
> 
> Die Klammern um job 1 bis job 3 sorgen nur dafür, dass das Environment
> (bis auf den Rückgabewert) nicht verändert wird.
> 
> (sleep 60 & sleep 60 & sleep 5) && echo "Fertig!"
> ps axf nach 0s:
> 13619 pts/1    Ss     0:00              \_ -/bin/bash
>  2846 pts/1    S+     0:00              |   \_ -/bin/bash
>  2847 pts/1    S+     0:00              |       \_ sleep 60
>  2848 pts/1    S+     0:00              |       \_ sleep 60
>  2849 pts/1    S+     0:00              |       \_ sleep 15
> 
> ps axf nach 10s:
>  2847 pts/1    S      0:00 sleep 60
>  2848 pts/1    S      0:00 sleep 60
> 
> ps axf nach 61s:
> 

Tach.

Damit sollte das vielleicht so gehen. Die jobs 1-3 werden im Hintergrund
ausgeführt. Ihre PIDs in den Variablen job1-3 gespeichert und danach auf
das Beenden der Jobs gewartet, bevor job4 ausgeführt wird,

#!/bin/bash
job1 & job1=$!
job2 & job2=$!
job3 & job3=$!
wait $job1
wait $job2
wait $job3
job4

wait $wmpid

- --
Mit freundlichen Grüßen

Hendrik Jürgens
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDBwhBgL2kQgmW9pgRAi7nAJ9U51o42vlYHY1O3eMZiE5IxI/D5ACfa9+V
L7k/Rq1vzkpYgFYNjK4YHFw=
=4Kz4
-----END PGP SIGNATURE-----
-- 
gentoo-user-de@gentoo.org mailing list



  reply	other threads:[~2005-08-20 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16 14:16 [gentoo-user-de] Bash-Skript Frage Volker Katz
2005-08-16 15:12 ` Emil Beinroth
2005-08-16 17:14 ` Nils Andresen
2005-08-20  5:01   ` Karsten Schulz
2005-08-20 10:04   ` [gentoo-user-de] " Thomas Schweikle
2005-08-20 10:39     ` Hendrik Jürgens [this message]
2005-08-20 13:16       ` Thomas Schweikle

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=43070874.7080507@gmx.net \
    --to=h.juergens@gmx.net \
    --cc=gentoo-user-de@lists.gentoo.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox