Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

linux - how to qsub jobs to the cluster from the parent directory for the subdirectories

I have difficulties in submitting my jobs from the parent directory in Linux. Assume that in my parent directory, I do have 1000 sub directories named 1,2,3 ...., 1000 in all of which there is a submission script submit.sh. Rather than going to each subdirectory and qsub individually which of course takes a huge time of mine, I need to qsub all scripts from the parent directory such that all calculations and outputs will be dumped out in the corresponding subdirectoy. is there any way to do so?

I do appreciate your help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

How about a shell script?

If you just need to run each submit.sh, then this should do what you're asking in bash:

for i in {1..1000}; do
  cd "$i"
  ./submit.sh
  cd ..
done

Or if you need to pass them as an argument to something, e.g. qsub, then just add whatever you need, for example:

for i in {1..1000}; do
  cd "$i"
  qsub submit.sh
  cd ..
done

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...