I'm using a cluster with Torque/Maui system. I have a bash script that submit one job, using qsub command, and afterwards does several things, like move files, write ASCII files, and check the output from the job I submitted. Concerning this output, basically, If it contains the number 1 the job need to be submitted again. If different of 1, the bash script does something else.
The problem is that the qsub run in background, and all the bash is evaluated at once. I'd like to force qsub to behaves pretty much like awk, cat, sort, etc ... when the script just goes further after those commands finish - if not put in background.
So, I need to the bash stops at the first qsub, and continue running just after qsub get finished, it means, when the job finish. Is there any way of doing this ? It will be something similar to:
-sync y # in the SGE system, for instance.
what I have:
#!/bin/bash
.
.
some commands
.
.
qsub my_application # need to wait until my_application get done
.
.
more commands
.
.
my_application_output=(`cat my_application_output.txt`)
case "$my_application_output" in
["1"])
qsub my_application
;;
["0"])
some commands
;;
["100"])
some commands
;;
*)
some commands
exit 1
esac
.
.
some remarks
- It is not convenient to use: qsub -I -x, once I'd like to keep the output on the output file; and do not want to lock out the node by starting a interactive mode (-I)
- I guess it is not a simple job dependency problem, once the re-submission 1) could occurs, 2) could not, and, most important, if occurs(1), it can be several times.
Thanks for all