Reputation: 151
I have a txt file (say jobs.txt) that has several lines like:
"sbatch -w node00x script.sh 1"
"sbatch -w node00z script.sh 10"
.
.
etc
I wonder if it is possible to create an executable bash file like the following
#!/bin/bash
while read -r line;
do submit the job by line;
done < jobs.txt;
that I can just execute and which will run the jobs in respective nodes. I have very limited knowledge in this area. Would appreciate any help.
Upvotes: 0
Views: 2276
Reputation: 4571
What I usually do in those cases is:
./jobs.txt
If you have set the execution permissions for that file (as its extension suggests), give them to it:
chmod u+x jobs.txt
And if it is necessary, I would add to the head of the jobs.txt:
#!/bin/bash
And if you want to remove any confusion with the file name, rename it:
mv jobs.txt jobs.sh
Now, you have a workload ready to be submitted!
Upvotes: 2
Reputation: 41
If I understand you correctly, you just need to do eval command:
eval $line
Upvotes: 2