sh script difficulties (running parallel functions)

David Naylor blackdragon at
Thu Nov 1 09:38:19 PDT 2007


I am having a hard time getting (very complex script for me) to work.  The
basic idea is that this script runs a bunch of tarkets, many of which are
time consuming but low on resources (such as downloading files).  Now if I
run the tarkets all at once (given some dependancy issues) it greatly speeds
up the process (about 5 time speed increase).  However I do not know how to
do this using sh...



worker1() {
  # Copy some files

worker2() {
  # Download some files

worker3() {
  # Do something else

..... # and so on

run_jobs() {
  worker1 &
  worker2 &
  worker3 &
  # !!! Somehow wait for over workers to finish before continuing !!!


Furthermore, how can signals be handled such that the signals get
accumulated and once all the other workers have finished the signals get
passed on (appropriately)

Thank you.


More information about the freebsd-questions mailing list