#! /bin/csh

# usage startnightly.tao test1 test2 ...


set dir=`dirname $0`
set bdir=`dirname $dir`
set pdir=`dirname $bdir`
set day=`date | cut -f1 -d" "`

foreach CONF ($*)
  set SSH=ssh
  set SCP=scp
  set DASHN=-n
  set BITKEEPER=yes
  source $dir/confignightly/${CONF}

  echo "start TAO build at `date`:$SSH $USR@$MACH $DASHN $TAO_LOC/bin/maint/buildtest $CONF $LOC" 
  if ("${BITKEEPER}" == "yes") then
    $SSH $USR@$MACH $DASHN "cd $TAO_LOC ; bk pull; $TAO_LOC/bin/maint/buildtest $CONF $LOC" &
  else
    rsync -e ssh -az --delete  $pdir/../tao-devel/ ${USR}@${MACH}:${TAO_LOC}
    $SSH $USR@$MACH $DASHN "cd $TAO_LOC; $TAO_LOC/bin/maint/buildtest $CONF $LOC" &
  endif

  sleep 300 # perhaps ease the load on petsc.bkbits.net by spacing the builds
end
wait
