Skip to content

Instantly share code, notes, and snippets.

@pedrovgs
Created August 2, 2017 08:51
Show Gist options
  • Save pedrovgs/ef9c8469ef1e512756ab5bd08d4a3b2b to your computer and use it in GitHub Desktop.
Save pedrovgs/ef9c8469ef1e512756ab5bd08d4a3b2b to your computer and use it in GitHub Desktop.
Bash script to enqueue jobs using qsub
#!/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