Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7913)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7914)
@@ -55,4 +55,5 @@
        (relative path for Mars version)
      - moved setup from jobsourcefile to sourcefile
+     - added locking for gettodo
 
    * datacenter/scripts/setup: 
@@ -93,4 +94,7 @@
      datacenter/scripts/writesequencefiles:
      - improved logging and comments
+
+   * datacenter/scripts/scriptlauncher: 
+     - added (script to start submit other scripts to condor)
 
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/jobmanager
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/jobmanager	(revision 7913)
+++ trunk/MagicSoft/Mars/datacenter/scripts/jobmanager	(revision 7914)
@@ -38,12 +38,12 @@
    for (( i=0 ; i < ${#scripts[@]} ; i++ ))
    do 
-      date  #>> $scriptlog 2>&1
-      echo "sleeping $sleeptime..." #>> $scriptlog 2>&1
+      date  >> $scriptlog 2>&1
+      echo "sleeping $sleeptime..." >> $scriptlog 2>&1
       sleep $sleeptime
       dayofweek=`date +%u`
       hour=`date +%k`
       source `dirname $0`/sourcefile
-      echo "script: ${scripts[$i]}" #>> $scriptlog 2>&1
-#      echo " day: $dayofweek hour: $hour" #>> $scriptlog 2>&1
+      echo "script: ${scripts[$i]}" >> $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`
@@ -59,7 +59,7 @@
       num=`echo "((( $i + 1 ) * 24 ) + ( $hour + 1 ) ) - 24 - 1 " | bc `
       pnoscript=${pnos[$num]}
-      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 " 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
       
       if [ "$queued" -gt "$pnototal" ]
@@ -73,11 +73,15 @@
       fi
 
+      # get todofile
+      lockfile=$lockpath/lock-getting-${script[$i]}-list.txt
+      checklock  >> $scriptlog 2>&1
       singleprocess="yes"
       gettodo 
+      rm -v $lockfile >> $scriptlog 2>&1
 
       date=`date +%Y/%m/%d`
       date2=`date +%Y-%m-%d`
       condordir=$logpath/condor/$date
-      makedir $condordir #>> $scriptlog 2>&1
+      makedir $condordir >> $scriptlog 2>&1
       
       if ! /usr/local/bin/condor_submit -a path=$scriptspath -a prog=${scripts[$i]} -a date=$date2 -a dir=$condordir $scriptspath/run.condor 2>$errorlog
Index: trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher	(revision 7913)
+++ trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher	(revision 7914)
@@ -33,5 +33,5 @@
 scriptslog=$logpath/scriptlauncher/`date +%Y/%m`/jobmanager`date +%F`.log
 
-date  #>> $scriptlog 2>&1
+date  >> $scriptlog 2>&1
 
 path=`dirname $0`
@@ -47,9 +47,9 @@
       continue
    fi
-   echo "launching $i..." #>> $scriptlog 2>&1
+   echo "launching $i..." >> $scriptlog 2>&1
    /usr/local/bin/condor_submit -a path=$path -a prog=$i -a date=$date2 -a dir=$condordir $path/run.condor >/dev/null  2>$errorlog
    if ! echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog
    then
-      echo " waiting for $i to be done..." #>> $scriptlog 2>&1
+      echo " waiting for $i to be done..." >> $scriptlog 2>&1
       /usr/local/bin/condor_wait $condordir/condor-$date2.log >/dev/null 2>$errorlog
    fi
