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
