Ignore:
Timestamp:
08/15/08 13:49:05 (16 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher

    r8482 r9122  
    3131printprocesslog "INFO starting $0 $@"
    3232
    33 makedir $listpath
    34 makedir $lockpath
    35 
    3633errorlog=$runlogpath/scriptlauncher-error`date +%F`.log
    3734scriptlog=$runlogpath/scriptlauncher`date +%F`.log
     
    4239date=`date +%Y-%m-%d`
    4340
    44 scripts=( `echo $@ | sed -e 's/allatthesametime//'` )
    45 num=${#scripts[@]}
    46 echo "$num scripts have to be launched" >> $scriptlog 2>&1
    47 i=0
     41num=$#
     42echo "$num scripts have to be launched" #>> $scriptlog 2>&1
     43i=1
    4844
    49 while [ $i -lt $num ]
     45if echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog
     46then
     47   all="yes"
     48else
     49   all="no"
     50fi
     51
     52while [ $i -le $num ]
    5053do
    51    echo " launching ${scripts[$i]}..." >> $scriptlog 2>&1
    52    pid=`/usr/local/bin/condor_submit -a path=$path -a prog=${scripts[$i]} -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2`
     54   com=( )
     55   prog=
     56   if [ "$1" = "allatthesametime" ]
     57   then
     58      shift
     59      i=`expr $i + 1`
     60      continue
     61   fi
     62   com=( $1 )
     63   prog=${com[0]}
     64   if ! ls $path/${com[0]} >/dev/null 2>&1
     65   then
     66      echo "script $path/$1 does not exist." >> $scriptlog 2>&1
     67      shift
     68      i=`expr $i + 1`
     69      continue
     70   fi
     71   if [ `echo $1 | wc -w` -gt 1 ]
     72   then
     73      unset com[0]
     74      args='-a args="'${com[@]}'"'
     75   fi
     76   echo " launching $1..." >> $scriptlog 2>&1
     77   echo "/usr/local/bin/condor_submit -a path=$path -a prog=$prog $args -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2" >> $scriptlog 2>&1
     78   pid=`/usr/local/bin/condor_submit -a path=$path -a prog=$prog $args -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2`
    5379   if [ "$pid" = "" ]
    5480   then
    5581      echo `date`" WARN condor is not working " >> $errorlog 2>&1
    56       printprocesslog "WARN submitting ${scripts[$i]} to condor failed"
     82      printprocesslog "WARN submitting $1 to condor failed"
     83      shift
     84      i=`expr $i + 1`
    5785      continue
    5886   fi
    59    if ! echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog
     87   if [ "$all" = "no" ]
    6088   then
    61       echo "  waiting for ${scripts[$i]} to be done..." >> $scriptlog 2>&1
     89      echo "  waiting for $1 to be done..." >> $scriptlog 2>&1
    6290      /usr/local/bin/condor_wait $runlogpath/condor-$date.log $pid >/dev/null 2>$errorlog
    6391   fi
     92   shift
    6493   i=`expr $i + 1`
    6594done
Note: See TracChangeset for help on using the changeset viewer.