Index: trunk/Mars/datacenter/scripts/runcallisto_mc
===================================================================
--- trunk/Mars/datacenter/scripts/runcallisto_mc	(revision 9920)
+++ trunk/Mars/datacenter/scripts/runcallisto_mc	(revision 10041)
@@ -37,16 +37,30 @@
 
 # get sequence # 
-gettodo "1" 
-sequence=${primaries[0]}
-cereskey=${primaries[1]}
-
-# lock sequ for cal
-lockfile=$lockpath/lock-$step-$sequence-$cereskey.txt
-checklock 
+numchanged=0
+while (( 0 < 21 ))
+do 
+   if ! [ $numchanged -eq 1 ]
+   then 
+      if ! [ "$sequence" = "" ] && ! [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO $program for sequence $sequence cereskey $cereskey is already running => request new number "
+      fi
+      gettodo "1" 
+      sequence=${primaries[0]}
+      cereskey=${primaries[1]}
+      if [ "$sequence" = "" ] || [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO nothing to do for $program "
+      fi
+   else
+      printprocesslog "INFO starting $program for sequence $sequence cereskey $cereskey"
+      break
+   fi
+   setstatus "start"
+done
 
 cd $mars
 
 # run calibration for sequence
-printprocesslog "INFO starting $program for sequence $sequence cereskey $cereskey"
 
 # define files and paths
@@ -57,6 +71,4 @@
 callistorc=$setuppath/$program/`printf %03d $cereskey`/callisto.rc
 inpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $sequence | cut -c 1-4`/`printf %08d $sequence | cut -c 5-8`
-
-setstatus "start"
 
 command="./callisto -b -q -v4 -f --out=$outpath --ind=$inpath --log=$log.log --html=$log.html --config=$callistorc $sequfile"
