Index: trunk/DataCheck/Processing/RunCallisto.sh
===================================================================
--- trunk/DataCheck/Processing/RunCallisto.sh	(revision 18764)
+++ trunk/DataCheck/Processing/RunCallisto.sh	(revision 18765)
@@ -9,21 +9,37 @@
 set -C
 
-for (( i=0; i<100; i++ ))
-do 
-   # get todo list
-   gettodo "1"
+# get night and seqid
+if [ "$night" = "" ] && [ "$seqid" = "" ]
+then 
+   # if no number are provided by JobManager
+   for (( i=0; i<100; i++ ))
+   do 
+      # avoid too many simultaneous queries
+      sleep $(( ( RANDOM % 10 )  + 1 ))
+      # get todo list
+      gettodo "1"
+      echo ${primaries[@]}
 
-   # get all needed variables
-   night=${primaries[0]}
-   seqid=${primaries[1]}
+      # get all needed variables
+      night=${primaries[0]}
+      seqid=${primaries[1]}
+      nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
+      seqnum=$night"_"`printf %03d $seqid`
+
+      # check if script is already running
+      lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
+      checklock continue
+      printprocesslog "INFO got todo with try #"$i
+      break
+   done
+else
    nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
    seqnum=$night"_"`printf %03d $seqid`
-
    # check if script is already running
    lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
-   checklock continue
-   printprocesslog "INFO got todo with try #"$i
-   break
-done
+   checklock 
+   s=0
+   primaries=( $night $seqid )
+fi
 
 # get all needed paths and files
@@ -47,7 +63,11 @@
 cd $mars
 
+# set status in DB
+#  maybe already done in JobManager
+#  but do it again to have real runtime
+setstatus "start" 
+
 # run callisto 
 printprocesslog "INFO starting callisto.C for sequence "$seqnum
-setstatus "start" 
 
 printprocesslog "DEBUG root -q -b fact/analysis/callisto.C\("\"$seqfile\""\,"\"$outpath\""\,\""$drstime"\"\,\""$delays"\"\) | tee $logfile "
Index: trunk/DataCheck/Processing/RunStar.sh
===================================================================
--- trunk/DataCheck/Processing/RunStar.sh	(revision 18764)
+++ trunk/DataCheck/Processing/RunStar.sh	(revision 18765)
@@ -9,21 +9,37 @@
 set -C
 
-for (( i=0; i<100; i++ ))
-do 
-   # get todo list
-   gettodo "1"
+# get night and seqid
+if [ "$night" = "" ] && [ "$seqid" = "" ]
+then 
+   # if no number are provided by JobManager
+   for (( i=0; i<100; i++ ))
+   do 
+      # avoid too many simultaneous queries
+      sleep $(( ( RANDOM % 10 )  + 1 ))
+      # get todo list
+      gettodo "1"
+      echo ${primaries[@]}
 
-   # get all needed variables
-   night=${primaries[0]}
-   seqid=${primaries[1]}
+      # get all needed variables
+      night=${primaries[0]}
+      seqid=${primaries[1]}
+      nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
+      seqnum=$night"_"`printf %03d $seqid`
+
+      # check if script is already running
+      lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
+      checklock continue
+      printprocesslog "INFO got todo with try #"$i
+      break
+   done
+else
    nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
    seqnum=$night"_"`printf %03d $seqid`
-
    # check if script is already running
    lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
-   checklock continue
-   printprocesslog "INFO got todo with try #"$i
-   break
-done
+   checklock 
+   s=0
+   primaries=( $night $seqid )
+fi
 
 # get all needed paths and files
@@ -36,7 +52,11 @@
 cd $mars
 
+# set status in DB
+#  maybe already done in JobManager
+#  but do it again to have real runtime
+setstatus "start" 
+
 # run star 
 printprocesslog "INFO starting star.C for sequence "$seqnum
-setstatus "start" 
 
 #check1=`root -q -b fact/star.C\("\"$seqfile\""\,7.5\,3.9\,"\"$inpath\""\,"\"$outpath\""\) | tee $logfile | intgrep`
@@ -65,6 +85,6 @@
    0)   printprocesslog "INFO merpp was successful for sequence "$seqnum" (check1=$check1)"
         ;;
-   *)   printprocesslog "ERROR merpp3.C failed for sequence "$seqnum" (check1=$check1)"
-        check=10
+   *)   printprocesslog "ERROR merpp.C failed for sequence "$seqnum" (check1=$check1)"
+        check=10$check1
         ;;
 esac
