Index: /trunk/MagicSoft/Mars/datacenter/db/mcinfo.php
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/db/mcinfo.php	(revision 9602)
+++ /trunk/MagicSoft/Mars/datacenter/db/mcinfo.php	(revision 9603)
@@ -55,5 +55,5 @@
                             ." IF (NOT ISNULL(" . $key . "Status.fStartTime) "
                             ." AND NOT ISNULL(" . $key . "Status.fStopTime) "
-                            ." AND ISNULL(" . $key . "Status.fReturnCode), 'done', 'bla' "
+                            ." AND ISNULL(" . $key . "Status.fReturnCode), 'done', 'failed' "
                             ." )))) AS '". $key . "', ";
             }
@@ -80,8 +80,12 @@
                         $query0 .= " ISNULL(" . $key . "Status.fStopTime) AND ";
                         $query0 .= " ISNULL(" . $key . "Status.fReturnCode), 'not done', ";
+                        $query0 .= " IF (NOT ISNULL(" . $key . "Status.fStartTime) ";
+                        $query0 .= " AND ISNULL(" . $key . "Status.fStopTime) ";
+                        $query0 .= " AND ISNULL(" . $key . "Status.fReturnCode), ";
+                        $query0 .= " CONCAT('running (since ', " . $key . "Status.fStartTime, ')'), ";
                         $query0 .= " IF (NOT ISNULL(" . $key . "Status.fReturnCode), ";
                         $query0 .= " CONCAT('failed (', " . $key . "Status.fReturnCode, ')'), ";
                         $query0 .= " CONCAT('done (', " . $key . "Status.fStopTime, ";
-                        $query0 .= " ',', TIMEDIFF(" . $key . "Status.fStopTime, " . $key . "Status.fStartTime), ')'))) ";
+                        $query0 .= " ',', TIMEDIFF(" . $key . "Status.fStopTime, " . $key . "Status.fStartTime), ')')))) ";
 
                         //$query0 .= ", CONCAT( 'halo', " . $key . "Status.fStartTime)";
Index: /trunk/MagicSoft/Mars/datacenter/scripts/runceres
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/scripts/runceres	(revision 9603)
+++ /trunk/MagicSoft/Mars/datacenter/scripts/runceres	(revision 9603)
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# ========================================================================
+#
+# *
+# * This file is part of MARS, the MAGIC Analysis and Reconstruction
+# * Software. It is distributed to you in the hope that it can be a useful
+# * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+# * It is distributed WITHOUT ANY WARRANTY.
+# *
+# * Permission to use, copy, modify and distribute this software and its
+# * documentation for any purpose is hereby granted without fee,
+# * provided that the above copyright notice appear in all copies and
+# * that both that copyright notice and this permission notice appear
+# * in supporting documentation. It is provided "as is" without express
+# * or implied warranty.
+# *
+#
+#
+#   Author(s): Daniela Dorner  06/2010 <mailto:daniela.dorner@unige.ch>
+#
+#   Copyright: MAGIC Software Development, 2000-2010
+#
+#
+# ========================================================================
+#
+# This script is launching ceres for corsika runs. 
+# 
+# The ceres.rc and other setup files are stored in the setup directory.
+#
+
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
+program=ceres
+step=Ceres
+
+set -C
+
+# get sequence # 
+gettodo "1"
+run=${primaries[0]}
+file=${primaries[1]}
+cereskey=${primaries[2]}
+
+# lock sequ for cal
+lockfile=$lockpath/lock-$step-$run.$file.$cereskey.txt
+checklock
+
+cd $mars
+
+# run calibration for sequence
+printprocesslog "INFO starting $program for run $run and file $file and ceres-setup $cereskey"
+
+setstatus "start"
+
+outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
+makedir $outpath
+log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
+setupfile=$setuppath/`printf %03d $cereskey`/ceres.rc
+
+query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fFileNumber="$file" AND fCeresSetupKEY="$cereskey
+runkey=`sendquery`
+
+case $runkey in 
+   2) printprocesslog "INFO run $run and file $file is a data run (key="$runkey")"
+      inputfile=$mcpath/corsika/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`/cer000`printf %06d $file | cut -c 4-6`
+      command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run $inputfile"
+      printprocesslog "INFO executing "$command
+      $command
+      check1=$?
+      ;;
+   3) printprocesslog "INFO run $run and file $file is a pedestal run (key="$runkey")"
+      command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
+      printprocesslog "INFO executing "$command
+      $command
+      check1=$?
+      ;;
+   4) printprocesslog "INFO run $run and file $file is a calibration run (key="$runkey")"
+      command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
+      printprocesslog "INFO executing "$command
+      $command
+      check1=$?
+      ;;
+   *) printprocesslog "WARN not valid fRunTypeKEY ("$runkey")was queried from the DB."
+      finish
+      ;;
+esac
+
+
+setstatus "stop"
+
+finish
+
Index: /trunk/MagicSoft/Mars/datacenter/scripts/runcorsika
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/scripts/runcorsika	(revision 9602)
+++ /trunk/MagicSoft/Mars/datacenter/scripts/runcorsika	(revision 9603)
@@ -195,5 +195,5 @@
 wavelengths=`sendquery`
 
-outpath=$mcpath"/"$program"/"`printf %08d $run | cut -c 0-4`/`printf %08d $run | cut -c 5-8`
+outpath=$mcpath"/"$program"/"`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
 makedir $outpath 
 logfile=$outpath/cer000`printf %06d $file | cut -c 4-6`".log"
