prüfung auf die beendigung eines prozesses

Post Reply
Message
Author
chupi

prüfung auf die beendigung eines prozesses

#1 Post by chupi »

hi
ich starte auf ner konsole den befehl "make bzImage" und das kompilieren geht los.
nun will ich auf der 2. konsole den befehl "make modules" ausführen, wenn das "make bzImage" fertig ist.
klar geht das mit "make bzImage; make modules" oder "make bzImage && make modules".
das dumme ist nur, wenn ich "make bzImage" schon gestartet habe und mir noch einfällt, dass ich einen andere befehl danach ausführen möchte.

eine lösung ist z.B. "sleep 600; make modules", aber das ist ziemlich billig...
oder folgendes script:

while true; do
if ps axc | grep make; then
echo "noch am compilen"
sleep 10
else make modules
break
fi
done

doch das ist auch nicht die beste lösung.
hat jemand was besseres?
was global eingesetzt werden könnte?


gruss chupi

Michael

Re: prüfung auf die beendigung eines prozesses

#2 Post by Michael »

wait prozessid && make modules

man wait

snip
----
wait [n]
Wait for the specified process and return its ter­
mination status. n may be a process ID or a job
specification; if a job spec is given, all pro­
cesses in that job's pipeline are waited for. If n
is not given, all currently active child processes
are waited for, and the return status is zero. If
n specifies a non-existent process or job, the
return status is 127. Otherwise, the return status
is the exit status of the last process or job
waited for.
---
snap

Cheers

Michael

Post Reply