批量提交Bsub命令

来源:互联网 发布:数据恢复精灵离线激活 编辑:程序博客网 时间:2024/06/05 05:19
1. 创建脚本如 a.sh,内容:
#!/bin/bashfor ((i=1; i<=58; i++))do        bsub -q serial -e temp$i.err -o temp$i.log "./regex -p temp$i --m --i"done
2. 修改权限
chmod u+x a.sh
3. 执行 ./a.sh
4. 得到一系列结果文件,根据结果中的某行“final size: ”进行排序,使用shell文件 b.sh,内容如下:
#!/bin/bashfor ((i=1; i<=58; i++))doecho -n $i " " ; grep "final size" temp$i.err done

执行./b.sh: ./b.sh> entries

5. 接下来根据entries中的第四列进行排序:

sort -n -k 4 entries | awk "{printf $1, $4}" > sorted_entries

6. 根据排序后的文件跑程序,建立 c.sh ,内容如下:

list=(9 14 39 44 45 16 28 3 7 21 42 38 22 54 4 32 33 23 37 10 30 5 41 35 36 40 43 19 11 31 34 51 53 18 55 58 8 15 20 56 29 6 48 47 57 46 49 52 13 1 26 25 27 2 12 24 50 17)for ((i=2; i<=58; i++))doprintf "bsub -q serial -e ttrend_$i.err -o ttrend_$i.log \"./regex -pm $i "for ((j=0; j<$i; j++))doprintf "temp%d " "${list[$j]}" doneprintf " --m --i\";"echodone 
list是排好序的文件名。

7. 执行c.sh:./c.sh > tempbatch.sh

8. 给tempbatch.sh加上shell头 #!/bin/bash

执行tempbatch.sh,从而最终提交批处理任务。

原创粉丝点击