+#### Hack: especially on multicore/multiprocessor machines, need
+#### to allow time for the output file to be closed. If the output
+#### file never reaches a size greater than zero after waiting for
+#### a short while, let a subsequent check fail to find what it needs.
+#### $1: pid to wait for
+#### $2: output file that must eventually have non-zero size
+wait_for_script() {
+ wait $1
+
+ for i in 1 2 3 4 5 6 7 8 9 10; do
+ test -s "$2" && break || sleep 1
+ done
+}
+
+