#!/bin/csh -f
#
# Batch submit for laue programs: (called from laue.cmd)
#
# lbatch script logfile timlim
#
# script   is the script file to be executed
# logfile  is the name of the output log file
# timlim   is the maximum time limit in seconds (may be omitted)
#
# Convex version
#
set CMDNAM = $1
set OUT = $2
set timlim = $3
set btq=v
if($timlim != "")then
  @ timlim = $timlim
  set temp=`batchqs|grep long`
  set temp=`echo $temp[2]|tr "." " "`
  if($timlim <= $temp[1]) set btq=l
  set temp=`batchqs|grep medium`
  set temp=`echo $temp[2]|tr "." " "`
  if($timlim <= $temp[1]) set btq=m
  set temp=`batchqs|grep short`
  set temp=`echo $temp[2]|tr "." " "`
  if($timlim <= $temp[1]) set btq=s
endif
echo "submit job with log file $OUT in batch queue $btq"
qsub -q $btq -o $OUT -eo $CMDNAM
exit
