#!/usr/bin/ksh

#------------------------------------------------------------
#launches qsub using qrsh
#and sets parameters with qalter
#syntax: launch_qsub script 
#------------------------------------------------------------ 
. $WFU_PATH/global.site.ksh
script=$1



batchlog=$2
#---------------------------------------------------
#execute qrsh to set environment paths properly
#then execute qalter to set restart , error  and output files


#---------------------------------------------------
echo qrsh $script >> $batchlog







reply=`qrsh -verbose -now no $script 2>$script.sge_out` 


 


echo $reply >> $batchlog
id=`cat $script.sge_out | grep Your | cut -d ' ' -f4`
echo id $id >> $batchlog

qalter -r y -e $script.sge_error -o $script.sge_output $id >>$script.sge_out 2>>$script.sge_out
qstat -j $id >>$script.sge_out 2>>$script.sge_out

exit


