我有一个shell脚本,它有一个qsub命令,后面跟着其他命令,这取决于qsub命令的输出。我有一个外壳脚本,看起来像

qsub <my_jobs>
cat <some_files>
grep <some_pattern>

我希望qsub在脚本转到cat命令之前完成运行。我把“等等”放在Qsub后面,但没用。

最佳答案

在qsub命令行中添加“-sync y”。
从手册中:http://gridscheduler.sourceforge.net/htmlman/htmlman1/qsub.html

 -sync y[es]|n[o]
      -sync y causes qsub to wait for  the  job  to  complete
      before  exiting.   If  the  job completes successfully,
      qsub's exit code will be that of the completed job.  If
      the job fails to complete successfully, qsub will print
      out a error message indicating why the job  failed  and
      will  have  an exit code of 1.  If qsub is interrupted,
      e.g. with CTRL-C, before the  job  completes,  the  job
      will be canceled.
      With the -sync n option, qsub will exit  with  an  exit
      code of 0 as soon as the job is submitted successfully.
      -sync n is default for qsub.

关于linux - 暂停shell脚本,直到上一个命令完成,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33440978/

10-09 21:35