diff master/bin/wrun.sh @ 30:9275e2a8b5e2

hacking to get id into wbash.sh, maybe buggy?
author Henry S. Thompson <ht@markup.co.uk>
date Mon, 19 Nov 2018 18:32:30 +0000
parents 2fbefb8d1a9e
children
line wrap: on
line diff
--- a/master/bin/wrun.sh	Mon Nov 19 18:31:21 2018 +0000
+++ b/master/bin/wrun.sh	Mon Nov 19 18:32:30 2018 +0000
@@ -22,12 +22,17 @@
 name=$1
 cmd="$2"
 shift 2
+if [ "$1" = "-d" ]
+then
+ debug=-d
+ shift
+fi
 if [ "$1" = "-x" ]
 then
- id=-x
+ xx=-x
  shift
 else
- id=
+ xx=
 fi
 if [ "$1" = "-np" ]
 then
@@ -46,10 +51,7 @@
  file=$2
  shift 2
  tfile=$(mktemp)
- split -n r/$np -u --filter="cat > $tfile\$\$" $file &
- # Wait for files to be built
- while [ $np -gt $(ls ${tfile}* | wc -l) ]; do echo -n . 1>&2; sleep 1; done
- echo 1>&2
+ tee >(wc -l 1>&2) | split -n r/$np -u --filter="cat > $tfile\$\$" $file
  wc -l ${tfile}* 1>&2
 elif [ "$1" = "-ff" ]
 then
@@ -83,6 +85,6 @@
   while read i ip port
    do
     echo $i $port $ip
-   done) | \
- parallel --gnu --colsep ' ' -j $np "$(dirname "$0")"/internal/invoke.sh $wait $id $me "$cmd" {} "$@" || { r=$? ; echo parallel exited with status=$r 1>&2;}
-if [ "${tfile}" ]; then rm ${tfile}*; fi
+   done) | tee /tmp/test.txt | \
+ parallel --gnu --colsep ' ' -j $np "$(dirname "$0")"/internal/invoke.sh $debug $wait $xx $me "$cmd" {} "$@" || { r=$? ; echo parallel exited with status=$r 1>&2;}
+#if [ "${tfile}" ]; then rm ${tfile}*; fi