Running multiple commands in parallel on the Sun Grid
A sample grid script to execute a simple command on the sun grid can look like this.
#$ -N jobName
#$ -S /bin/sh
#$ -cwd
myCommand
However, if one needs to run multiple independent commands in parallel, the following procedure can be followed.
Enter all the commands in a file called myCommands.in, say.
#$ -N jobName
#$ -S /bin/sh
#$ -cwd
PATH=.:$PATH
export PATH
inputFile=myCommands.in
i=1
while read inputLine
do
echo "#\$ -N Command$i" > script$i.sh
echo "#\$ -S /bin/sh" >> script$i.sh
echo "#\$ -cwd" >> script$i.sh
echo "PATH=.:\$PATH" >> script$i.sh
echo "export PATH" >> script$i.sh
echo $inputLine >> script$i.sh
$SGE_BINARY_PATH/qsub script$i.sh
i=`expr $i + 1`
done < $inputFile
HTH