0

我有一个看起来像这样的批处理作业

sbatch --wrap "perl test.pl file1 file2"

sbatch --wrap "perl test.pl file3 file4"

sbatch --wrap "perl test.pl file5 file6"

sbatch --wrap "perl test.pl file7 file8"

列表一直持续到

sbatch --wrap "perl test.pl file49 file50"

如何按顺序运行单个作业?谢谢,

4

1 回答 1

0

您必须根据前一个脚本的最终确定来制作一个脚本:

JOBID=$(sbatch --wrap "perl test.pl file1 file2" | awk '{print $4}')
for N in {3..49..2}
do
    JOBID=$(sbatch -d afterok:$JOBID --wrap "perl test.pl file$N file$(($N+1))" | awk '{print $4}')
done

顺便说一句,singleton评论中建议的方法也是一种很好的方法,可以让您摆脱 JobID 管理的困扰。

于 2018-07-19T07:25:51.040 回答