Created
August 2, 2017 08:51
-
-
Save pedrovgs/ef9c8469ef1e512756ab5bd08d4a3b2b to your computer and use it in GitHub Desktop.
Bash script to enqueue jobs using qsub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Let's enqueue some jobs β€οΈ" | |
if [ "$*" == "" ]; then | |
echo "We will try to enqueue every folder named Instance_X" | |
for dir in `find . -name "*Instance_*"` | |
do | |
echo "I've found an instance folder: $dir. Interesting π€" | |
cd $dir | |
qsub *.sge | |
echo "Please, review if there is a job in the queue for the related to the folder = $dir π" | |
cd .. | |
done | |
else | |
echo "We will try to enqueue every folder between the params passed" | |
echo "Param 1 = $1" | |
echo "Param 2 = $2" | |
for dir in `find . -name "*Instance_*"` | |
do | |
folderNumber=$(echo $dir | sed 's/[^0-9]*//g') | |
if [ $folderNumber -ge "$1" ] && [ $folderNumber -le "$2" ]; then | |
echo "I've found an instance folder: $dir. Interesting π€" | |
echo "Let's enqueue a job πͺπΌ" | |
cd $dir | |
qsub *.sge | |
echo "Please, review if there is a job in the queue for the related to the folder = $dir π" | |
cd .. | |
fi | |
done | |
fi | |
echo "That's it! You can review if the jobs are already being executed executing qstat :) π" | |
echo "Have a nice day! π π¦ ππ» ππΌ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment