Index: trunk/DataCheck/Processing/JobManager.sh
===================================================================
--- trunk/DataCheck/Processing/JobManager.sh	(revision 18759)
+++ trunk/DataCheck/Processing/JobManager.sh	(revision 18764)
@@ -45,5 +45,5 @@
             # (-hard) -l hostname=compute-*
             #   for qstat this returns the jobs running on that node + all jobs in the queue
-            alias 'queuesubmit'='$sgepath/qsub -b y -q `echo ${queues[$i]}` -t 1-`echo $tosubmit` -v AUTOMATIONSETUP=$AUTOMATIONSETUP -e `echo $runlogpath`/error-`echo $date`.log -o `echo $runlogpath`/log-`echo $date`.log `echo $noderequirementsub` -N `echo $step` `echo $scriptspath`/`echo ${scripts[$i]}` '
+            alias 'queuesubmit'='$sgepath/qsub -b y -q `echo ${queues[$i]}` -t 1-`echo $tosubmit` -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v night=$night -v seqid=$seqid -e `echo $runlogpath`/error-`echo $date`.log -o `echo $runlogpath`/log-`echo $date`.log `echo $noderequirementsub` -N `echo $step` `echo $scriptspath`/`echo ${scripts[$i]}` '
             #alias 'queuesubmit'='$sgepath/qsub -b y -q fact_long -t 1-`echo $tosubmit` -v AUTOMATIONSETUP=$AUTOMATIONSETUP -e `echo $runlogpath`/error-`echo $date`.log -o `echo $runlogpath`/log-`echo $date`.log `echo $noderequirementsub` -N `echo $step` `echo $scriptspath`/`echo ${scripts[$i]}` '
 #            alias 'queuesubmit'='$sgepath/qsub -b y -v AUTOMATIONSETUP=$AUTOMATIONSETUP -e `echo $runlogpath`/error-`echo $date`.log -o `echo $runlogpath`/log-`echo $date`.log `echo $scriptspath`/`echo ${scripts[$i]}` '
@@ -298,22 +298,43 @@
       fi
 
-      # set $tosubmit to 1 if something is 'qw', because in this case 
-      #   only one line for several jobs might be shown
-      if [ ${idlescript[$i]} -gt 0 ] # && [ "$step" == "Callisto" ]
-      then 
+# submitting individual job now giving night and seqid
+#      # set $tosubmit to 1 if something is 'qw', because in this case 
+#      #   only one line for several jobs might be shown
+#      if [ ${idlescript[$i]} -gt 0 ] # && [ "$step" == "Callisto" ]
+#      then 
+#         tosubmit=1
+#      fi
+      #echo "tosubmit: "$tosubmit
+
+      # get todo list
+      gettodo 
+      # setting upper limit for loop
+      if [ $num -gt $tosubmit ]
+      then
+         num=$tosubmit
+      fi
+      
+      for (( s=0 ; s < $num ; s++ ))
+      do
          tosubmit=1
-      fi
-      echo "tosubmit: "$tosubmit
-      # submit $tosubmit scripts to queuing system
-      #tosubmit=1 #workaround for test on fact cluster
-      echo `date +%F\ %T`" Submitting "$tosubmit" jobs for script '"${scripts[$i]}"' to "$queuesys >> $jmscriptlog 2>&1
-      date=`date +%Y-%m-%d`
-      if ! queuesubmit 2>> $jmerrorlog
-      then 
-         echo `date`" WARN submitting job ($queuesys) failed" >> $jmerrorlog
-         echo `date +%F\ %T`" WARN $queuesys is not working -> sleeping $errorsleeptime [\$errorsleeptime]" >> $jmscriptlog 2>&1
-         printprocesslog "WARN submitting ${scripts[$i]} ($queuesys) failed"
-         sleepawhile "error"
-      fi
+         night=${primaries[$s+$s]}
+         seqid=${primaries[$s+$s+1]}
+         
+         echo "submit "${scripts[$i]}" "$night" "$seqid
+         
+         # set status in DB
+         setstatus "startj" 
+         
+         # submit $tosubmit scripts to queuing system
+         echo `date +%F\ %T`" Submitting ("$s"/"$tosubmit") jobs for script '"${scripts[$i]}"' (night:"$night" seq"$seqid") to "$queuesys >> $jmscriptlog 2>&1
+         date=`date +%Y-%m-%d`
+         if ! queuesubmit 2>> $jmerrorlog
+         then 
+            echo `date`" WARN submitting job ($queuesys) failed" >> $jmerrorlog
+            echo `date +%F\ %T`" WARN $queuesys is not working -> sleeping $errorsleeptime [\$errorsleeptime]" >> $jmscriptlog 2>&1
+            printprocesslog "WARN submitting ${scripts[$i]} ($queuesys) failed"
+            sleepawhile "error"
+         fi
+      done
       echo ""
    done
