Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7909)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7912)
@@ -53,48 +53,30 @@
 date >> $scriptlog 2>&1
 
-# finding todo file
-echo "checking if other todo-files are there" >> $scriptlog 2>&1
-if  ls $todofile-[1-9]*.txt >> $scriptlog 2>&1
+# get todo file
+possibletodofiles=`ls -r $listpath/ToDo-*-$column-*.txt`  >> $scriptlog 2>&1
+if [ "$possibletodofiles" = "" ]
 then 
-   echo "other file(s) on disk " >> $scriptlog 2>&1
-   echo " -> choose one file and run $program" >> $scriptlog 2>&1
+   echo "ERROR: in $program no todofiles found => something went wrong in jobmanager"
+   finish >> $scriptlog 2>&1
 else
-   # check if getting of list is already running
-   checklock "getting list of" >> $scriptlog 2>&1
-   # get todo list
-   gettodo  >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
+   singleprocess="yes"
+   echo "todofiles: "${possibletodofiles[@]} >> $scriptlog 2>&1
+   for possibletodofile in ${possibletodofiles[@]}
+   do 
+      if ! ls $possibletodofile >> $scriptlog 2>&1
+      then 
+         echo "file is not on disk -> continue" >> $scriptlog 2>&1
+         continue
+      fi
+      lockfile=`echo $possibletodofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
+      checklock >> $scriptlog 2>&1
+      todofile=$possibletodofile
+   done
 fi
-
-# choosing todo file
-nr=bla
-echo "finding the right todo-file" >> $scriptlog 2>&1
-todofiles=`ls $listpath/ToDo-$table-$column-*`
-
-for todofile in ${todofiles[@]}
-do 
-   if ! ls $todofile >> $scriptlog 2>&1
-   then 
-      echo "file is not on disk -> continue" >> $scriptlog 2>&1
-      continue
-   fi
-   lockfile=`echo $todofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
-   date > $lockfile >> $scriptlog 2>&1
-   checklock=$?
-   case $checklock in 
-       0)   echo "checklock=$checklock -> setting number" >> $scriptlog 2>&1
-            nr=${i}
-            break;;
-       1)   echo "checklock=$checklock -> file exists -> continue" >> $scriptlog 2>&1;;
-       *)   echo "checklock=$checklock -> something went completely wrong" >> $scriptlog 2>&1;;
-   esac
-done
-
-case $nr in
-   bla)      echo "everything is beeing processed -> exit" >> $scriptlog 2>&1
-             date  >> $scriptlog 2>&1
-             exit;;
-   12345678) echo "process nr: "$nr >> $scriptlog 2>&1;;
-esac
+if [ "$todofile" = "" ]
+then 
+   echo "no todofile found -> exit"  >> $scriptlog 2>&1
+   finish >> $scriptlog 2>&1
+fi
 
 # retrieve dataset from todo file
@@ -110,4 +92,5 @@
 for dataset in ${datasets[@]}
 do 
+  echo "run $program for dataset $dataset..." >> $scriptlog 2>&1
   no=`printf %08d $dataset | cut -c 0-5`
   no2=`printf %08d $dataset`
@@ -115,9 +98,7 @@
   var2=$no2
   outpath="$datapath/$program/$no/$no2"
-  echo "outpath: "$outpath >> $scriptlog 2>&1
   makedir $outpath >> $scriptlog 2>&1
 
   datasetfile="$datasetpath/$no/dataset$no2.txt"
-  echo "datasetfile: "$datasetfile >> $scriptlog 2>&1
   # get observation mode to choose ganymed.rc file
   wobble=`grep 'WobbleMode:' $datasetfile` >> $scriptlog 2>&1 
@@ -131,5 +112,4 @@
   ganymedrc=$setuppath/ganymed/ganymed_$mode.rc
   
-  echo "run $program..." >> $scriptlog 2>&1
   setstatus "start" >> $scriptlog 2>&1
 
@@ -138,11 +118,11 @@
 
   case $check1 in
-     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1 ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+     0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1 ;;
+     *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
           com=$Fganymed
           check=$check1
           ;;
   esac
-  echo "inserting the status for $program for dataset $dataset into the db" >> $scriptlog 2>&1
+  
   setstatus "stop" >> $scriptlog 2>&1
 done
