I am using a cluster Grid Engine. I first wrote a shell script called test.sh as following
#!/usr/bin/bash
export R="/share/apps/R/3.1.1/intel/2013.0.028"
export INIT_DIR="$PWD"
CHR=4
let K=`wc -l chr"$CHR"_1.bim | awk '{print $1}'`
let dist=50
n=$((($K + $dist - 1) / $dist))
for ((k=1;k<=n;k++))
do
i=$((($k - 1) * $dist +1))
j=$(($k * $dist))
if [ "$k" == "$n" ]
then
pos2=`tail -n 1 chr"$CHR"_1.bim | awk '{print $4}'`
else
pos2=`sed ""$j"q;d" chr"$CHR"_1.bim | awk '{print $4}'`
fi
pos1=`sed ""$i"q;d" chr"$CHR"_1.bim | awk '{print $4}'`
$R/bin/R --no-save --no-restore < ${INIT_DIR}/chr"$CHR"_"$pos1"_to_"$pos2".R
echo $pos1 $pos2 >> POS_FILE_1
done
Then, I use qgenscript
to generate a test_qsub.sh
. Then, I use qsub test_qsub.sh
to run the program.
The problem Sometimes it runs well. However, sometimes, after it is running for a while, the program stop to output(which means it is not running),but it is supposed to output,e.g.
rep=1
rep=2
rep=3
.
.
.
And there is no error in output file. But quser
still show that test.sh
is running.