Commit ade862a4 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Bash script to keep track of running jobs

parent 8ae539f7
...@@ -75,28 +75,58 @@ class BiopetFifoPipe(val root: Configurable, ...@@ -75,28 +75,58 @@ class BiopetFifoPipe(val root: Configurable,
object BiopetFifoPipe { object BiopetFifoPipe {
val waitScript = val waitScript =
""" """
|
|allJobs=`jobs -p`
|jobs=$allJobs
|
|echo [`date`] pids: $jobs
| |
|FAIL="0" |FAIL="0"
| |
|for job in `jobs -p` |while echo $jobs | grep -e "\d" > /dev/null
|do |do
|echo $job | for job in $jobs
| wait $job || let "FAIL+=1" | do
| if ps | grep "$job " | grep -v grep > /dev/null
| then
| echo [`date`] $job still running > /dev/null
| else
| jobs=`echo $jobs | sed "s/${job}//"`
| wait $job || FAIL=$?
| if echo $FAIL | grep -ve "^0$" > /dev/null
| then
| echo [`date`] $job fails with exitcode: $FAIL
| break
| fi
| echo [`date`] $job done
| fi
| done
| if echo $FAIL | grep -ve "^0$" > /dev/null
| then
| break
| fi
| sleep 1
|done |done
| |
|echo $FAIL |if echo $FAIL | grep -ve "^0$" > /dev/null
|then
| echo [`date`] kill other pids: $jobs
| kill $jobs
|fi
|
|echo [`date`] Done
|
| |
""".stripMargin """.stripMargin
val endScript = val endScript =
""" """
echo $FAIL
| |
|if [ "$FAIL" == "0" ]; |if [ "$FAIL" == "0" ];
|then |then
|echo "BiopetFifoPipe Done" |echo [`date`] "BiopetFifoPipe Done"
|else |else
|echo BiopetFifoPipe "FAIL! ($FAIL)" |echo [`date`] BiopetFifoPipe "FAIL! ($FAIL)"
|exit $FAIL |exit $FAIL
|fi |fi
| |
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment