Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7936)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7944)
@@ -39,6 +39,7 @@
 webpath=/www/htdocs/datacenter
 
-processlogpath=$logpath/run/`date +%Y/%m/%d`
-processlog=$processlogpath/process`date +%F`.log
+runlogpath=$logpath/run/`date +%Y/%m/%d`
+makedir $runlogpath
+processlog=$runlogpath/process`date +%F`.log
 
 datetime=`date +%F-%H-%M-%S`
@@ -76,4 +77,8 @@
 # setup for jobmanager
 #
+#log files (can't be defined in script itself, as script can run longer 
+#than one day
+jmerrorlog=$runlogpath/jobmanager-error`date +%F`.log
+jmscriptlog=$runlogpath/jobmanager`date +%F`.log
 steps=$mars/steps.rc
 # resetting values
@@ -120,4 +125,5 @@
    rm -v $lockfile
    date 
+   printprocesslog "INFO finished $program"
    exit
 }
@@ -234,5 +240,6 @@
                ;;
           *)   echo "error -> exit"
-               exit
+               printprocesslog "ERROR function evalstatus got wrong variable"
+               finish
                ;;
    esac
@@ -304,5 +311,6 @@
    if ! process=`mysql -s -u $us --password=$pw --host=hercules $db -e " $query "`
    then
-      echo "ERROR could not query process from db -> exit"
+      echo "ERROR could not query processes from db -> exit"
+      printprocesslog "ERROR could not query processes from db (program: $program, function getdolist)"
       finish
    fi
@@ -318,4 +326,5 @@
       then
          echo "$todofile exists already"
+         printprocesslog "WARN $todofile exists already (program: $program, function getdolist)"
          finish
       fi
@@ -349,4 +358,5 @@
    then
       echo "ERROR could not query process from db -> exit"
+      printprocesslog "ERROR could not query process from db (program: $program, function gettodo)"
       finish
    fi
@@ -384,4 +394,5 @@
    then
       echo "ERROR could not query number of todo proceses from db -> continue"
+      printprocesslog "ERROR could not query number of processes from db (program: $program, function getstatus)"
       cont
    fi
@@ -400,4 +411,5 @@
    then
       echo "YOU CAN'T RESET $column for $var2!!!" 
+      printprocesslog "ERROR you can't reset $column for $var2"
       finish
    fi
@@ -416,6 +428,7 @@
    then 
       echo "ERROR could not insert status into db -> exit"
-      finish
-   fi
-
-}
+      printprocesslog "ERROR could not set status in db (program: $program, function setstatus)"
+      finish
+   fi
+
+}
