Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7907)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7908)
@@ -44,8 +44,14 @@
      - removed changing variables 
      - added addresses
+     - implemented functions to get todolist via shell
 
    * datacenter/scripts/jobmanager: 
      - added (script to controll the amount of callisto, star, ganymed
        and datacheck running)
+     - reduced logging output
+     - implemented gettodo
+     - implemented possibility to run several tests by one user 
+       (relative path for Mars version)
+     - moved setup from jobsourcefile to sourcefile
 
    * datacenter/scripts/setup: 
@@ -54,4 +60,11 @@
    * datacenter/scripts/copyscript: 
      - removed addresses
+     - fixed typo
+
+   * datacenter/scripts/run.condor: 
+     - added (file used to submit scripts to condor, used by jobmanager
+       and script launcher)
+
+   * steps.rc: 
      - fixed typo
 
@@ -384,6 +397,6 @@
    * steps.rc:
      - made interpretable for shell
-     - set Default to check, so that manually inserted sequences can't 
-       be resettet
+     - set Default to check for fSequenceFileWritten, so that manually 
+       inserted sequences can't be resettet
 
    * datacenter/scripts/makecallistolinks:
Index: trunk/MagicSoft/Mars/datacenter/scripts/jobmanager
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/jobmanager	(revision 7907)
+++ trunk/MagicSoft/Mars/datacenter/scripts/jobmanager	(revision 7908)
@@ -30,9 +30,6 @@
 
 
-#source `dirname $0`/sourcefile (is done in jobsourcefile)
-
+source `dirname $0`/sourcefile
 user=`whoami`
-sourcefile=/home/$user/Mars.cvs/datacenter/scripts/jobsourcefile
-source $sourcefile
 
 notcount=0
@@ -46,13 +43,11 @@
       dayofweek=`date +%u`
       hour=`date +%k`
-      source $sourcefile
+      source `dirname $0`/sourcefile
       echo "script: ${scripts[$i]}" #>> $scriptlog 2>&1
-      echo " day: $dayofweek hour: $hour" #>> $scriptlog 2>&1
+#      echo " day: $dayofweek hour: $hour" #>> $scriptlog 2>&1
       queued=`/usr/local/bin/condor_q -global -format "%s\n" Owner | grep -c $user`
       queued=`setzero $queued`
-      echo " found $queued jobs in the queue (incl. running jobs)" #>> $scriptlog 2>&1
       queuedscript=`/usr/local/bin/condor_q -global | grep $user | grep -c ${scripts[$i]}`
       queuedscript=`setzero $queuedscript`
-      echo " found $queuedscript ${scripts[$i]} in the queue (incl. running jobs)" #>> $scriptlog 2>&1
 
       pnototal=${pnototal[$hour]}
@@ -64,12 +59,12 @@
       num=`echo "((( $i + 1 ) * 24 ) + ( $hour + 1 ) ) - 24 - 1 " | bc `
       pnoscript=${pnos[$num]}
-      echo " => num=$num => pnoscript=$pnoscript (i.e. $pnoscript ${scripts[$i]} allowed)" #>> $scriptlog 2>&1
+      echo " found $queued jobs in the queue (incl. running jobs) [allowed $pnototal]" #>> $scriptlog 2>&1
+      echo " found $queuedscript ${scripts[$i]} in the queue (incl. running jobs) [allowed $pnoscript]" #>> $scriptlog 2>&1
+#      echo "  => num=$num => pnoscript=$pnoscript (i.e. $pnoscript ${scripts[$i]} allowed)" #>> $scriptlog 2>&1
       
-      echo " queued: $queued - pnototal: $pnototal" #>> $scriptlog 2>&1
       if [ "$queued" -gt "$pnototal" ]
       then
          continue
       else
-         echo " queued ${scripts[$i]}: $queuedscript - pno: $pnoscript" #>> $scriptlog 2>&1
          if [ "$queuedscript" -gt "$pnoscript" ]
          then
@@ -77,37 +72,7 @@
          fi
       fi
-      
-      echo " gettodo..."
-      echo "getting db..."
-      db=`grep Database $mars/sql.rc | grep -v '#' | sed -e 's/Database: //' -e 's/ //g'`
-      col=${scriptscolname[$i]}
-      table=`grep "$col:" $steps | sed -e "s/[.]$col://" -e 's/#//' -e 's/ //g'`
-      coltab=`grep "$col:" $steps | sed -e 's/://' -e 's/#//' -e 's/ //g'`
-      needs=`grep "$coltab[.]Needs:" $steps | sed -e "s/$coltab[.]Needs://"`
-      influences=`grep "$coltab[.]Influences:" $steps | sed -e "s/$coltab[.]Influences://"`
-      primary=fSequenceFirst
-      echo "db: $db - col $col - table $table - coltab $coltab"
-      echo "needs: $needs"
-      echo "influences: $influences"
-      query="select $primary from $table where "
-      for need in $needs
-      do
-         query=$query" not isnull($need) and"
-      done
-      for influence in $influences
-      do 
-         query=$query" isnull($influence) and"
-      done
-      query=$query" isnull(fStartTime) and isnull(fFailedTime) and isnull(fFailedCode) and isnull(fFailedCodeAdd) and isnull(fReturnCode) order by $primary desc limit 0, 1 "
-      echo "QUERY: "$query
-      echo ""
-      echo " gettodofiles -> pno"
 
-      if [ "$pno" == "0" ]
-      then
-         echo " pno = $pno -> continue" #>> $scriptlog 2>&1
-         echo "" #>> $scriptlog 2>&1
-         continue
-      fi
+      singleprocess="yes"
+      gettodo 
 
       y=`date +%Y`
@@ -115,11 +80,10 @@
       d=`date +%d`
       condordir=$logpath/condor/$y/$m/$d
-      makedir  $condordir #>> $scriptlog 2>&1
+      makedir $condordir #>> $scriptlog 2>&1
       
-      echo "  ---> starting $pno ${scripts[$i]}..." #>> $scriptlog 2>&1
+#      echo "  ---> starting ${scripts[$i]} for $process" #>> $scriptlog 2>&1
       
       #test
-      echo ""
-      continue
+      contex
       #test
       if ! /usr/local/bin/condor_submit -a path=$scriptspath -a prog=${scripts[$i]} -a y=$y -a m=$m -a d=$d $scriptspath/run.condor 2>$errorlog
Index: trunk/MagicSoft/Mars/datacenter/scripts/run.condor
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/run.condor	(revision 7908)
+++ trunk/MagicSoft/Mars/datacenter/scripts/run.condor	(revision 7908)
@@ -0,0 +1,12 @@
+copy_to_spool = false
+Executable    = $(path)/$(prog)
+Universe      = vanilla
+Log           = condor-$(y)-$(m)-$(d).log
+output        = log-$(y)-$(m)-$(d).log
+error         = error-$(y)-$(m)-$(d).log
+notification  = Error
+
+Initialdir = /magic/datacenter/autologs/condor/$(y)/$(m)/$(d)
+
+Queue 
+
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7907)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7908)
@@ -236,4 +236,93 @@
 }
 
-
-
+function getdbsetup()
+{
+   db=`grep Database $mars/sql.rc | grep -v '#' | sed -e 's/Database: //' -e 's/ //g'`
+   pw=`grep Password $mars/sql.rc | grep -v '#' | sed -e 's/Password: //' -e 's/ //g'`
+   us=`grep User $mars/sql.rc | grep -v '#' | sed -e 's/User: //' -e 's/ //g'`
+#   echo "setup: "
+#   echo " db: "$db
+#   echo " pw: "$pw
+#   echo " us: "$us
+}
+
+function getstepinfo()
+{
+   if [ "$singleprocess" = "yes" ]
+   then 
+      column=${scriptscolname[$i]}
+   fi
+   table=`grep "$column:" $steps | sed -e "s/[.]$column://" -e 's/#//' -e 's/ //g'`
+   coltab=`grep "$column:" $steps | sed -e 's/://' -e 's/#//' -e 's/ //g'`
+   needs=`grep "$coltab[.]Needs:" $steps | sed -e "s/$coltab[.]Needs://"`
+   influences=`grep "$coltab[.]Influences:" $steps | sed -e "s/$coltab[.]Influences://"`
+   primary=`grep "$table[.]Primary:" $steps | sed -e "s/$table[.]Primary://"`
+#   echo " column $column - table $table - coltab $coltab"
+#   echo " needs: $needs"
+#   echo " influences: $influences"
+#   echo " primary: $primary"
+}
+
+function contex()
+{
+   echo ""
+   if [ "$singleprocess" = "yes" ]
+   then 
+      continue
+   else
+      exit
+   fi
+}
+
+function gettodo()
+{
+   echo "getting todo..."
+   getdbsetup 
+   getstepinfo
+   # get query
+   query=" select $primary from $table where "
+   if ! echo $needs | grep '#' > /dev/null 
+   then 
+      for need in $needs
+      do
+         query=$query" not isnull($need) and"
+      done
+   fi
+   if ! echo $influences | grep '#' > /dev/null 
+   then 
+      for influence in $influences
+      do 
+         query=$query" isnull($influence) and"
+      done
+   fi
+   query=$query" isnull(fStartTime) and isnull(fFailedTime) and isnull(fFailedCode) and isnull(fFailedCodeAdd) and isnull(fReturnCode) order by $primary desc "
+   if [ "$singleprocess" = "yes" ]
+   then 
+      query=$query" limit 0, 1 "
+   fi
+#   echo " QUERY: "$query
+   process=`mysql -s -u $us --password=$pw --host=hercules $db -e " $query "`
+
+   if [ "$process" = "" ]
+   then
+      echo "  => nothing to do" 
+      contex 
+   else 
+      if [ "$singleprocess" = "yes" ]
+      then 
+         listfile=$listpath/ToDo-$table-$column-$process.txt
+         echo "  => found $process"
+      else
+         listfile=$listpath/ToDo-$table-$column.txt
+         echo "found processes"
+      fi
+#      echo " list: "$listfile
+      
+      if ls $listfile > /dev/null 2>&1
+      then
+         echo "$listfile exists already"
+         contex 
+      fi
+      echo $process > $listfile
+   fi
+}
Index: trunk/MagicSoft/Mars/steps.rc
===================================================================
--- trunk/MagicSoft/Mars/steps.rc	(revision 7907)
+++ trunk/MagicSoft/Mars/steps.rc	(revision 7908)
@@ -27,5 +27,5 @@
 
 
-#SequenceBuildStatus.fExclusionsDone.: 
+#SequenceBuildStatus.fExclusionsDone: 
 SequenceBuildStatus.fExclusionsDone.Default: no
 SequenceBuildStatus.fExclusionsDone.Needs: SequenceBuildStatus.fCCFilled 
@@ -34,5 +34,5 @@
 
 
-#SequenceBuildStatus.fSequenceEntriesBuilt.: 
+#SequenceBuildStatus.fSequenceEntriesBuilt: 
 SequenceBuildStatus.fSequenceEntriesBuilt.Default: no
 SequenceBuildStatus.fSequenceEntriesBuilt.Needs: SequenceBuildStatus.fCCFilled SequenceBuildStatus.fExclusionsDone 
