#!/bin/bash p=$1 rm -f combine.log > /dev/null rm -f combine.err > /dev/null rm -f combine.out > /dev/null if [ "$p" = "1" ] then echo '#!/bin/bash' > combine.pbs echo 'if [[ "$PBS_O_WORKDIR" != "" ]]; then' >> combine.pbs echo ' cd $PBS_O_WORKDIR' >> combine.pbs echo 'fi' >> combine.pbs echo "../bin/combine_events;touch combine.out" >> combine.pbs chmod u+x combine.pbs echo "$qsub -q medium $j" qsub -q medium -e combine.err -o combine.log -V combine.pbs >> ../running_jobs while [ ! -e combine.out ] do sleep 1 done rm -f combine.pbs sleep 5 ###################################################### #ji+ #this two files are not ready yet ... do the cat later while [ ! -e combine.log ] do echo "[WARNING] combine.log not available yet, job not completely finished ... waiting" sleep 10 done cat combine.log while [ ! -e combine.err ] do echo "[WARNING] combine.err not available yet, job not completely finished" sleep 10 done cat combine.err #ji else ../bin/combine_events fi # Remove huge scratch file rm -f scratch