Could someone please explain the following to me? I expect that I'm missing something simple, but I don't understand what I am seeing.
I have a bash script, the relevant part of which looks like this: ---- for (( yr=$MIN_YEAR; yr <= $MAX_YEAR; yr++)) do echo "creating maps for $yr" sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] sem -j-1 rbn-posters-map.py [parameters to python script] done sem --wait echo "After wait" ps auxw | grep rbn ---- My understanding, which is obviously incomplete, was that the "sem --wait" command would cause the script to block until all the various "rbn-posters.py" jobs that had been started with sem had completed. Therefore, I expected that the "ps" command would find none of those jobs still to be running. However, what actually happens, consistently, is that 3 such jobs are running when the "ps" command is executed (on this machine there are four cores). I need to have all the jobs completed at the point where the "ps" is currently placed, so that the next part of the script will run correctly. But at the moment, because not all the "rbn-posters.py" jobs have completed, the next part fails. I welcome enlightenment as to why the "sem --wait" isn't doing what I expected. (And bonus points if someone can explain how to modify the sem commands in the script so as to be sure that they have all completed at the point where the "ps" is currently located, preferably while still allowing parallel execution of the "rbn-posters.py" jobs.) I thank you very much. Doc Evans -- Web: http://www.sff.net/people/N7DR
signature.asc
Description: OpenPGP digital signature
