StephenMcGowan
asked on
Looping a shell script
Hi,
I have a shell script (pipeline.sh) located in the following directory:
/fs/nas15/home/mqbpgsm4/pe rmanalysis /bin
I would like to run 1000 instances of this script on a linux server by submitting it to a queue using Qsub 1000 times.
i.e:
qsub -b y (/directory/permanalysis/b in) -N perm1 sh pipeline.sh
I would like to loop it so that the job is submitted to server 1000 times:
i.e.
qsub -b y (/directory/permanalysis/b in) -N perm1 sh pipeline.sh
qsub -b y (/directory/permanalysis/b in) -N perm2 sh pipeline.sh
qsub -b y (/directory/permanalysis/b in) -N perm3 sh pipeline.sh
to
qsub -b y (/directory/permanalysis/b in) -N perm1000 sh pipeline.sh
Is this at all possible?
Thanks,
Stephen
I have a shell script (pipeline.sh) located in the following directory:
/fs/nas15/home/mqbpgsm4/pe
I would like to run 1000 instances of this script on a linux server by submitting it to a queue using Qsub 1000 times.
i.e:
qsub -b y (/directory/permanalysis/b
I would like to loop it so that the job is submitted to server 1000 times:
i.e.
qsub -b y (/directory/permanalysis/b
qsub -b y (/directory/permanalysis/b
qsub -b y (/directory/permanalysis/b
to
qsub -b y (/directory/permanalysis/b
Is this at all possible?
Thanks,
Stephen
for i in $(seq 1 1000)
do
qsub -b y (/directory/permanalysis/bin) -N $i sh pipeline.sh
done
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Guys,
Thanks for getting back to me.
Would I need to define the bin folder for the location of pipeline.sh?
i.e:
Thanks,
Stephen
Thanks for getting back to me.
Would I need to define the bin folder for the location of pipeline.sh?
i.e:
#define pipeline.sh location
$directory=~/fs/nas15/home/mqbpgsm4/permanalysis/bin
X=1
while [ $X -le 1000 ];
do
eval "qsub -b y $directory -N perm$X sh pipeline.sh"
X=`expr $X + 1`
done
Thanks,
Stephen
Yes you could do that, otherwise place the script in the same folder.
ASKER
Sorry,
Just to double check, would the attached file work ok?
I just want to double check this out before potentially submitting 1000 jobs to the server.
Thanks again,
Stephen
loopscript.sh
Just to double check, would the attached file work ok?
I just want to double check this out before potentially submitting 1000 jobs to the server.
Thanks again,
Stephen
loopscript.sh
You could try something like this:
Open in new window