Hi,
I am wondering if it is possible to use command line arguments to make small modifications to a file.sh that I have and use to submit jobs to a computing cluster using qsub, or if failing this I can write a separate script to generate a suitable file to submit.
Currently, I have something like
Code:
#!/bin/bash
showopts () {
while getopts ":q:n:j:" optname
do
case "$optname" in
"q")
$OPTARG < queueType
;;
"n")
$OPTARG < jobName
;;
"j")
$OPTARG < progToExecute
;;
":")
echo "No argument value for option $OPTARG"
;;
*)
echo "Unknown error while processing options"
;;
esac
done
return $OPTIND
}
PROGTOEXECUTE=$progToExecute
echo "$PROGTOEXECUTE"
QUEUETYPE=$jobName
echo "$QUEUETYPE"
JOBname=$queueType
echo "$JOBname"
#$ -S /bin/bash
#$ -cwd
#$ -N $JOBname
#$ -q $QUEUETYPE
#$ -M email.address
#$ -j no
#$ -l h_vmem=2.5g
#$ -l virtual_free=1.5g
#$ -m abe
$PROGTOEXECUTE > statusLog$JOB_NAME
The sh file that I normally submit is the section at the bottom - starting at #$ -S /bin/bash and running to the end of the code section.
The earlier part of the code is my attempt to move the information sent to the script out of a subshell, but clearly I have misunderstood what I've been reading. The echo commands next to where I'm trying to write assignments are just to test their (in)efficacy, and would be removed from a working script/.sh file. Also, the $JOB_NAME variable in the last line is set to be whatever follows the "#$ -N " part.
In case it is unclear, I'd hope to be able to write something like:
>> qsub file.sh -q short -n name -j "tar -xzf tarfile.tar.gz"
as a simple example.
Any help would be much appreciated.