Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to run a series of jobs submitted to the cluster, one after the other, by suplpying the following .sh script:

Annotation_Loop.sh :

#!/bin/bash

job=`qsub run_IntersectBed_1.sh 0`
for i in {1..3}
do
    job_next=`qsub -hold_jid $job run_IntersectBed_1.sh $i`
    job=$job_next
done

The first job (before entering the loop) is executed, but the next ones are never started.

I think the script is well written. I change the mode to an executable and run it as

nohup ./Annotation_Loop.sh (I think this is necessary?) ... but the rest is never done.

I tried -W before, using -W depend=afterok:$job in place of -hold_jid $job

#!/bin/bash

    job=`qsub run_IntersectBed_1.sh 0`
    for i in {1..3}
    do
        job_next=`qsub -W depend=afterok:$job run_IntersectBed_1.sh $i`
        job=$job_next
    done

But it returned unknown option -W.

What could be going wrong? :(

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The ouput of qsub has the jobid inside a message text. In my case:

$ qsub hello.sh
Your job 8845476 ("hello.sh") has been submitted

You should extract the jobid from this message. E.g:

$ jobid=$(qsub hello.sh | cut -d' ' -f3)
$ echo $jobid
8845481

Maybe your qsub version, has a different message, try it out separatly and then put a cut to get the jobid as a string.

share|improve this answer
    
thank you, @zhen! –  Carmen Sandoval May 1 '13 at 23:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.