批量提交作业的shell脚本

时间: 2024-11-10 admin IT培训

批量提交作业的shell脚本

批量提交作业的shell脚本

目的:将多个作业提交到不同的计算节点上。

#首先确定好哪些节点可用,然后更改下面的代码

#Define the number-1 of the first visit folder(framenum)
framenum=24
for nodeid in `seq 1 5` 8 10 11 `seq 14 18` `seq 23 29` `seq 31 34` 12 19 42 43
#for nodeid in 41 13 9 7 12
do
    #let num+=1
    framenum=`expr $framenum + 1`
    if [ -d /home3/maoruichao/dynamics/1nkz/revision/temp_diff/sec_330k/image_1000ns/spectrum_last100ns_100frames/3_g16_coup/330k_$framenum/bcl_addh_gjf ]
    then
        #Define the number of the last visit folder
        if [ $framenum -le 100 ]
        then
            process=`unode | grep "n$nodeid " | awk '{printf $2 "\n"}'`
            echo "The process number of node $nodeid is $process"
            if [ $process == 0 ]
            then
                ssh n$nodeid "cd /home3/maoruichao/dynamics/1nkz/revision/temp_diff/sec_330k/image_1000ns/spectrum_last100ns_100frames/3_g16_coup/330k_$framenum/bcl_addh_gjf;nohup sh rung16.sh > rung16.out 2>&1 &"
                echo "Job $framenum has running on node $nodeid..."
            else
                echo "node$nodeid is not empty! continue to next one"
                framenum=`expr $framenum - 1`
                continue
            fi
        else
            echo "$framenum is equal to 101! break now"
            break
        fi
    else
        echo ""/home3/maoruichao/dynamics/1nkz/revision/temp_diff/sec_330k/image_1000ns/spectrum_last100ns_100frames/3_g16_coup/330k_$framenum/bcl_addh_gjf" is not exsist! break now"
        break
    fi
done