Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7467)
@@ -170,5 +170,7 @@
   fi
 
-  echo "run callisto..." >> $scriptlog 2>&1
+  echo "run $program..." >> $scriptlog 2>&1
+  setstatus "start"
+
   ./callisto -b -q -v4 -f -raw --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile  2>> $scriptlog > /dev/null
   check1=$?
@@ -206,5 +208,7 @@
              then
                 echo "no ccfile found for run "$runno >> $scriptlog 2>&1
-                break 2
+                com="no ccfile for run $runno"
+                check=0
+                break
              fi
              echo "cacofile: "$cacofile >> $scriptlog 2>&1
@@ -229,4 +233,8 @@
                    fi
                 done
+                echo "no cacofile found" >> $scriptlog 2>&1
+                com="no cacofile for run $runno"
+                check=0
+                break
              fi
              ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --html=$merpplogpath/merppccupdate$runno.html --auto-time-stop --runfile=$runno $ccfile $calfile 2>> $scriptlog> /dev/null
@@ -235,5 +243,7 @@
                      0)   echo "check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1;;
          	     *)   echo "check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
-                          continue 2 ;;
+                          com="merppccupdate failed for run $runno"
+                          check=$check2
+                          break ;;
              esac
              ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null
@@ -242,20 +252,18 @@
                      0)   echo "check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1;;
          	     *)   echo "check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
-                          continue 2 ;;
+                          com="merppcacoupdate failed for run $runno"
+                          check=$check3
+                          break ;;
              esac
           done
-          
-          # set status for calibration if merpp updates are also done
-          echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
-          statustime="Now()"
-          failed="NULL"
-          starttime="NULL"
-          failedtime="NULL"
-          var1=$no
-          var2=$no2
-          setstatus
   	  ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
+     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+          com="calibration failed"
+          check=$check1
+          ;;
   esac
+  # set status 
+  echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
+  setstatus "stop"
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7467)
@@ -160,20 +160,18 @@
   
   echo "run $program..." >> $scriptlog 2>&1
+  setstatus "start"
+
   ./ganymed -b -q -v4 -f --ind=$datapath/star --config=$ganymedrc --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath $datasetfile  2>> $scriptlog> /dev/null
   check1=$?
 
   case $check1 in
-     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1
-          echo "inserting the status for $program for dataset $dataset into the db" >> $scriptlog 2>&1
-          statustime="Now()"
-          failed="NULL"
-          starttime="NULL"
-          failedtime="NULL"
-          var1=$no
-          var2=$no2
-          setstatus
+     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1 ;;
+     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+          com="ganymed failed"
+          check=$check1
           ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
   esac
+  echo "inserting the status for $program for dataset $dataset into the db" >> $scriptlog 2>&1
+  setstatus "stop"
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7467)
@@ -152,20 +152,18 @@
   
   echo "run $program..." >> $scriptlog 2>&1
+  setstatus "start"
+
   ./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile  2>> $scriptlog> /dev/null
   check1=$?
 
   case $check1 in
-     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1
-          echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
-          statustime="Now()"
-          failed="NULL"
-          starttime="NULL"
-          failedtime="NULL"
-          var1=$no
-          var2=$no2
-          setstatus
-  	  ;;
-     *)   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="star failed"
+          check=$check1
+          ;;
   esac
+  echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
+  setstatus "stop"
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7467)
@@ -61,10 +61,58 @@
 }
 
+function resetstatusvalues()
+{
+   statustime=NULL
+   starttime=NULL
+   failedcode=NULL
+   failedcomment=NULL
+   failedtime=NULL
+}
+
+function printstatusvalues()
+{
+   echo "the current values are:"
+   echo " statustime=$statustime"
+   echo " starttime=$starttime"
+   echo " failedcode=$failedcode"
+   echo " failedcomment=$failedcomment"
+   echo " failedtime=$failedtime"
+   echo "-- check: -$check-"
+   ech
+   echo ""
+}
+
 function setstatus()
 {
+   # set status values
+   resetstatusvalues
+   case $@ in 
+      start)   echo "start"
+               starttime="Now()"
+               ;;
+       stop)   echo "stop"
+               case $check in
+                  0)  echo " ok"
+                      statustime="Now()"
+                      ;;
+                  *)  echo " failed"
+                      starttime=noreset
+                      failedcode=$check
+                      failedcomment=$com
+                      failedtime="Now()"
+                      ;;
+               esac
+               ;;
+          *)   echo "error -> exit"
+               exit
+               ;;
+   esac
+   check=
+   
+   # set status 
    setstatuslogpath=$logpath/setstatus/$program/$var1
    makedir $setstatuslogpath >> $scriptlog 2>&1
-   setstatuslog=$setstatuslogpath/setstatus-$program-$var2.log
-   checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failed\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
+   setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
+   checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failedcode\""\,"\"$failedcomment\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
    case $checkstatus in
       1)   echo "checkstatus=$checkstatus -> everything ok, status has been set" >> $scriptlog 2>&1;;
@@ -72,2 +120,5 @@
    esac
 }
+
+
+
