Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7943)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7944)
@@ -48,10 +48,63 @@
      datacenter/scripts/scriptlauncher: 
      - improved logging
+     - implemented usage of printprocesslog
 
    * datacenter/scripts/jobmanager: 
      - improved usage of resources
 
+   * datacenter/scripts/scriptlauncher: 
+     - improved errorhandling
+
    * datacenter/scripts/sourcefile: 
      - implemented function and paths for processlog
+
+   * datacenter/scripts/copyscript, datacenter/scripts/insertdatasets, 
+     datacenter/scripts/doqualityplots, datacenter/scripts/dowebplots, 
+     datacenter/scripts/linkmc, datacenter/scripts/makecallistolinks, 
+     datacenter/scripts/mcsequences, 
+     datacenter/scripts/insertsequences,
+     datacenter/scripts/processmcsequences: 
+     - implemented usage of finish
+     - improved logging
+
+   * datacenter/scripts/doexclusions: 
+     - implemented check=1 (was still missing)
+
+   * datacenter/scripts/correcttime, 
+     datacenter/scripts/insertsequences,
+     datacenter/scripts/makecallistolinks: 
+     - improved logging
+     - fixed bugs
+
+   * datacenter/scripts/checkfilesforsequenceavail, 
+     datacenter/scripts/filesondisk, datacenter/scripts/runcallisto: 
+     - improved logging
+
+   * datacenter/scripts/buildsequenceentries, 
+     datacenter/scripts/checkfilesforsequenceavail, 
+     datacenter/scripts/checkstardone, datacenter/scripts/copyscript, 
+     datacenter/scripts/correcttime, datacenter/scripts/dodatacheck, 
+     datacenter/scripts/doexclusions, datacenter/scripts/doqualityplots, 
+     datacenter/scripts/insertdatasets, datacenter/scripts/dowebplots, 
+     datacenter/scripts/filesondisk, datacenter/scripts/fillcallisto, 
+     datacenter/scripts/fillstar, datacenter/scripts/fillganymed, 
+     datacenter/scripts/insertsequences, datacenter/scripts/jobmanager, 
+     datacenter/scripts/linkmc, datacenter/scripts/makecallistolinks, 
+     datacenter/scripts/mcsequences, datacenter/scripts/movingrawfiles, 
+     datacenter/scripts/rmlock, datacenter/scripts/processmcsequences, 
+     datacenter/scripts/runstar, datacenter/scripts/runcallisto, 
+     datacenter/scripts/runganymed, datacenter/scripts/webupdate-star,
+     datacenter/scripts/webupdate-callisto, 
+     datacenter/scripts/webupdate-sinope, datacenter/scripts/sourcefile, 
+     datacenter/scripts/webupdate-ganymed,
+     datacenter/scripts/writesequencefiles: 
+     - implemented usage of printprocesslog
+     - fixed runlogpath
+
+   * datacenter/scripts/webupdate-callisto, 
+     datacenter/scripts/webupdate-ganymed, 
+     datacenter/scripts/webupdate-sinope, 
+     datacenter/scripts/webupdate-star: 
+     - added logging
 
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 7944)
@@ -35,20 +35,16 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=buildsequenceentries
-source `dirname $0`/sourcefile
+column=fSequenceEntriesBuilt
 
 set -C
 
-column=fSequenceEntriesBuilt
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -71,4 +67,5 @@
 do 
    echo "building sequence entries for date $date..." >> $scriptlog 2>&1
+   printprocesslog "INFO build sequence entries for $date"
    year2=`echo $date | cut -c 1-4`
    var1=$year2
@@ -83,9 +80,13 @@
 
    case $check1 in
-      1)   echo " check1=$check1 -> everything ok -> setting status for $date..." >> $scriptlog 2>&1;;
+      1)   echo " check1=$check1 -> everything ok -> setting status for $date..." >> $scriptlog 2>&1
+           printprocesslog "INFO sequence entries successfully built for $date"
+           ;;
       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            ;;
       *)   echo " check1=$check1 -> ERROR - $program.C failed for $date -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR $program.C failed for $date"
            com=$Fbuildsequ
            check=$check1
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 7944)
@@ -35,18 +35,14 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=checkfilesavail
-source `dirname $0`/sourcefile
-
 column=fAllFilesAvail
 
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -69,4 +65,5 @@
 do 
    echo "checking files for sequence $sequence..." >> $scriptlog 2>&1 
+   printprocesslog "INFO checking files for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
    no2=`printf %08d $sequence`
@@ -84,12 +81,17 @@
 
    case $check1 in
-      1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 ;;
+      1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 
+           printprocesslog "INFO files available for sequence $sequence"
+           ;;
       2)   echo " check1=$check1 -> files not yet available -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "INFO files not yet available for sequence $sequence"
            check="no"
            ;;
       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            ;;
-      *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+      *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR $program.C failed"
            com=$Ffilesavail
            check=$check1
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkstardone
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 7944)
@@ -36,18 +36,14 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=checkstardone
-source `dirname $0`/sourcefile
-
 column=fStarFilesAvail
 
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -61,5 +57,5 @@
    finish >> $scriptlog 2>&1
 fi
-echo "datasets: "${datasets[@]} #>> $scriptlog 2>&1
+echo "datasets: "${datasets[@]} >> $scriptlog 2>&1
 rm -v $todofile >> $scriptlog 2>&1
 
@@ -68,12 +64,13 @@
 for dataset in ${datasets[@]}
 do 
+   echo "checking files for dataset $dataset..." >> $scriptlog 2>&1 
+   printprocesslog "INFO checking files for dataset $dataset"
    no=`printf %08d $dataset | cut -c 0-5`
    no2=`printf %08d $dataset`
    var1=$no
    var2=$dataset
-   echo "checking files for dataset $dataset..." >> $scriptlog 2>&1 
    datasetfile=$datasetpath/$no/dataset`printf %08d $dataset`.txt
+   
    sequences=(`cat $datasetfile | grep Sequences | sed -e 's/SequencesOn://g' | sed -e 's/SequencesOff://g'`)
-   
    if [ "$sequences" = "" ]
    then
@@ -82,7 +79,6 @@
       continue
    fi
+   echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
    
-   echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
-
    outpath=$logpath/$program/$no/$no2
    makedir $outpath  >> $scriptlog 2>&1 
@@ -93,4 +89,5 @@
    do 
       echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
+      printprocesslog "INFO check availability for sequence $sequence"
 
       check1=`root -q -b $macrospath/checkstardone.C+\(\""$sequence\""\) | tee $outpath/checkstardone-$sequence.log | grep int | sed -e 's/(int)//'`
@@ -99,12 +96,15 @@
          1)   echo " check1=$check1 -> everything ok -> continue with next sequence..." >> $scriptlog 2>&1 ;;
          2)   echo " check1=$check1 -> files for sequence $sequence not yet available -> continue..." >> $scriptlog 2>&1 
+              printprocesslog "INFO files not yet available for sequence $sequence"
               check="no"
               break
               ;;
          0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+              printprocesslog "WARN connection to DB failed"
               check="no"
               break
               ;;
          *)   echo " check1=$check1 -> ERROR " >> $scriptlog 2>&1 
+              printprocesslog "ERROR $program.C failed"
               com=$Fstardone
               comadd=$sequence
Index: trunk/MagicSoft/Mars/datacenter/scripts/copyscript
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7944)
@@ -57,6 +57,7 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=copyscript
-source `dirname $0`/sourcefile
 
 set -C
@@ -67,11 +68,7 @@
 char=24
 datetime=`date +%F-%H-%M-%S`
-lockfile=$lockpath/lock-copyscript.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/copyscript-$datetime.log
-
+lockfile=$lockpath/lock-$program.txt
+
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
@@ -87,7 +84,5 @@
 then
    echo "couldn't create checkfile -> exit script" >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 else
    echo "checkfile created" >> $scriptlog 2>&1
@@ -109,7 +104,5 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
@@ -118,4 +111,5 @@
 for date in ${dates[@]}
 do 
+   printprocesslog "INFO processing files for $date"
    #find all files for this date
    files=`find $transdir/*/$date/ -name "*.*"`  >> $scriptlog 2>&1
@@ -129,5 +123,5 @@
    
    date2=`echo $date | sed -e 's/_/\//g'`
-   copylogpath=$logpath/copyscript/$date2
+   copylogpath=$logpath/$program/$date2
    echo "copylogpath: "$copylogpath >> $scriptlog 2>&1
    makedir $copylogpath >> $scriptlog 2>&1
@@ -155,8 +149,11 @@
             checkfillrbk=`root -q -b $macrospath/filldotrbk.C+\("\"$file\""\,kFALSE\) | tee $copylogpath/filldotrbk-$filename-log.txt | grep int | sed -e 's/(int)//'`
             case $checkfillrbk in
-               1) echo "checkfillrbk=$checkfillrbk -> everything ok " >> $scriptlog 2>&1 
-                  echo " -> go on with copying file" >> $scriptlog 2>&1 ;;
-               *) echo "checkfillrbk=$checkfillrbk - Error -> go on with next file" >> $scriptlog 2>&1 
-                  continue;;
+               1) echo " checkfillrbk=$checkfillrbk -> everything ok " >> $scriptlog 2>&1 
+                  echo "  -> go on with copying file" >> $scriptlog 2>&1 
+                  ;;
+               *) echo " checkfillrbk=$checkfillrbk - Error -> go on with next file" >> $scriptlog 2>&1 
+                  printprocesslog "ERROR filldotrbk.C failed for $file"
+                  continue
+                  ;;
             esac
          fi
@@ -166,16 +163,21 @@
             checkfillrun=`root -q -b $macrospath/filldotrun.C+\("\"$file\""\,kFALSE\) | tee $copylogpath/filldotrun-$filename-log.txt  | grep int | sed -e 's/(int)//'`
             case $checkfillrun in
-               1) echo "checkfillrun=$checkfillrun -> everything ok " >> $scriptlog 2>&1 
-                  echo "-> insert date in SequenceBuildStatus for $date" >> $scriptlog 2>&1 
+               1) echo " checkfillrun=$checkfillrun -> everything ok " >> $scriptlog 2>&1 
+                  echo "  -> insert date in SequenceBuildStatus for $date" >> $scriptlog 2>&1 
 
                   checkinsertdate=`root -q -b $macrospath/insertdate.C+\("\"$date\""\) | tee $copylogpath/insertdate-$date-log.txt   | grep int | sed -e 's/(int)//'`
                   case $checkinsertdate in
                      1) echo "date inserted" >> $scriptlog 2>&1 ;;
-                     *) echo "checkinsertdate=$checkinsertdate -> ERROR - insert date didn't work" >> $scriptlog 2>&1 
-                        continue;;
+                     *) echo " checkinsertdate=$checkinsertdate -> ERROR - insert date didn't work" >> $scriptlog 2>&1 
+                        printprocesslog "ERROR insertdate.C failed for $date"
+                        continue
+                        ;;
                   esac
-                  echo " -> go on with copying file" >> $scriptlog 2>&1 ;;
-               *) echo "checkfillrun=$checkfillrun Error -> go on with next file" >> $scriptlog 2>&1 
-                  continue;;
+                  echo " -> go on with copying file" >> $scriptlog 2>&1 
+                  ;;
+               *) echo " checkfillrun=$checkfillrun Error -> go on with next file" >> $scriptlog 2>&1 
+                  printprocesslog "ERROR filldotrun.C failed for $file"
+                  continue
+                  ;;
             esac
          fi
@@ -189,4 +191,5 @@
          else
             echo $file" couldn't be moved!!!!!" >> $scriptlog 2>&1 
+            printprocesslog "WARN moving of file $file didn't work"
          fi
 
@@ -195,4 +198,5 @@
          #already processed (entry in donelist) -> go on with next file
          echo $file": checksum not ok " >> $scriptlog 2>&1 
+         printprocesslog "WARN checksum for file $file is not ok"
       fi
    done
@@ -208,5 +212,5 @@
 #second part of the script:
 #update the catalog file magic_favorites.edb
-
+printprocesslog "INFO processing new catalog files"
 magfav=magic_favorites.edb #catalog filename
 catalog=$setuppath/$magfav #current catalogfile
@@ -218,4 +222,5 @@
 for catfile in ${catfiles[@]}
 do
+   printprocesslog "INFO processing catalog file $catfile"
    #write information into .diff
    echo "diff $catfile $catalog" >| $diff
@@ -240,5 +245,6 @@
          #inform $adrs about removed lines
          nail -s 'catalogfile - removed lines' $adrs < $diff
-         exit
+         printprocesslog "NEWS catalog file: lines have been removed ($catfile)"
+         finish >> $scriptlog 2>&1
       fi
       
@@ -252,5 +258,6 @@
       then 
          echo "could not do 'rsync -av $catalog $setuppath/oldcatalogs/$magfav.$date' -> exit" >> $scriptlog 2>&1 
-         exit
+         printprocesslog "ERROR rsync of catalog file ($catalog -> $oldcatalogpath/$magfav.$date) didn't work"
+         finish >> $scriptlog 2>&1
       fi
       #rsync new catalogfile to current catalogfile
@@ -258,9 +265,11 @@
       then 
          echo "could not do 'rsync -av $catfile $catalog' -> exit" >> $scriptlog 2>&1 
-         exit
+         printprocesslog "ERROR rsync of catalog file ($catfile -> $catalog) didn't work"
+         finish >> $scriptlog 2>&1
       fi
       #inform $adrs about changes
       echo "file has been rsynced sucessfully -> sending email" >> $scriptlog 2>&1 
       nail -s 'new catalogfile installed - new lines'  $adrs < $diff
+      printprocesslog "NEWS there are new lines in the catalogfile (see $catalog)"
       continue
    fi
@@ -273,12 +282,10 @@
       #inform $adrs about removed lines
       nail -s 'catalogfile - removed lines' $adrs < $diff
-      exit
+      printprocesslog "NEWS catalog file: lines have been removed ($catfile)"
+      finish >> $scriptlog 2>&1
    fi
 #   echo "nothing has changed ($catfile)"  >> $scriptlog 2>&1 
 done
 
-
-rm -v $lockfile >> $scriptlog 2>&1
-date >> $scriptlog 2>&1
-
-set +C
+finish >> $scriptlog 2>&1
+
Index: trunk/MagicSoft/Mars/datacenter/scripts/correcttime
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/correcttime	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/correcttime	(revision 7944)
@@ -37,15 +37,15 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=correct_raw_time
-source `dirname $0`/sourcefile
-
 column=fTimingCorrection
 
-lockfile=$lockpath/lock-$program.txt
-scriptlogpath=$runlogpath/$program
+scriptlog=$runlogpath/$program-$datetime.log
+date >> $scriptlog 2>&1
 
 if [ -e $todofile ]
 then 
-   echo "$program is already running -> exit"
+   echo "$program is already running -> exit" >> $scriptlog 2>&1
    exit
 fi
@@ -58,9 +58,8 @@
 if [ "$runs" = "" ]
 then 
-   echo "nothing to do -> exit" 
+   echo "nothing to do -> exit" >> $scriptlog 2>&1
    finish >> $scriptlog 2>&1
 fi
-echo "runs: "${runs[@]}
-rm -v $todofile >> $scriptlog 2>&1
+echo "runs: "${runs[@]} >> $scriptlog 2>&1
 
 cd $mars
@@ -68,36 +67,38 @@
 for run in ${runs[@]}
 do 
-  no=`printf %08d $run | cut -c 1-5`
-  var1=$no
-  var2=$run
-  echo "getting path for run $run ... "
-  infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[D,C,P,S]_*`
-  echo "infile:"$infile
-  outfile=`echo $infile | sed -e 's/-wrong-timing//g'`
-  echo "outfile:"$outfile
-  outpath=`dirname $outfile`
-  echo "outpath:"$outpath
-  makedir $outpath
+   printprocesslog "INFO run correct_raw_time for run $run"
+   no=`printf %08d $run | cut -c 1-5`
+   var1=$no
+   var2=$run
+   echo "getting path for run $run ... " >> $scriptlog 2>&1
+   infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[D,C,P,S]_*`
+   echo "infile:"$infile >> $scriptlog 2>&1
+   outfile=`echo $infile | sed -e 's/-wrong-timing//g'`
+   echo "outfile:"$outfile >> $scriptlog 2>&1
+   outpath=`dirname $outfile`
+   echo "outpath:"$outpath >> $scriptlog 2>&1
+   makedir $outpath >> $scriptlog 2>&1
 
-  timecorrpath=$outpath"/timecorrlogs"
-  echo "timecorrpath: "$timecorrpath
-  makedir $timecorrpath 
-  
-  check1=0
-  echo "run $program..." >> $scriptlog 2>&1
-  setstatus "start" >> $scriptlog 2>&1
+   timecorrpath=$outpath"/timecorrlogs"
+   echo "timecorrpath: "$timecorrpath >> $scriptlog 2>&1
+   makedir $timecorrpath >> $scriptlog 2>&1
 
-  /home/tape/MagicReadout/correct_raw_time $infile $outfile > $timecorrpath/$program-$run.log
-  check1=$?
+   check1=0
+   echo "run $program..." >> $scriptlog 2>&1
+   setstatus "start" >> $scriptlog 2>&1
 
-  case $check1 in
-     1)   echo "check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
-          com=$Ftimecorr
-          check=$check1
-          ;;
-  esac
-  echo "inserting the status for $program for run $run into the db" >> $scriptlog 2>&1
-  setstatus "stop" >> $scriptlog 2>&1
+   /home/tape/MagicReadout/correct_raw_time $infile $outfile > $timecorrpath/$program-$run.log
+   check1=$?
+
+   case $check1 in
+      1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 ;;
+      *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR $program failed"
+           com=$Ftimecorr
+           check=$check1
+           ;;
+   esac
+   
+   setstatus "stop" >> $scriptlog 2>&1
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck	(revision 7944)
@@ -40,4 +40,5 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=datacheck
 column=fDataCheckDone
@@ -45,8 +46,5 @@
 set -C
 
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
@@ -62,4 +60,5 @@
 
 echo "do $program for run "$run >> $scriptlog 2>&1
+printprocesslog "INFO do $program for run $run"
 no=`printf %08d $run | cut -c 0-2`
 no2=`printf %08d $run`
@@ -84,10 +83,13 @@
 case $check1 in 
    1)   echo " check1=$check1 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
+        printprocesslog "INFO finished filldotraw.C sucessfully for $rawfile"
         ;;
    0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
         check="no"
         setstatus "stop" >> $scriptlog 2>&1
         continue ;;
    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+        printprocesslog "ERROR filldotraw.C failed for $rawfile"
         com=$Ffillraw
         check=$check1
@@ -97,4 +99,5 @@
 
 # running sinope 
+printprocesslog "INFO running sinope for $run"
 sinopepath=$datapath/sinope/$date
 makedir $sinopepath >> $scriptlog 2>&1
@@ -113,4 +116,5 @@
             ;;
        *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+            printprocesslog "ERROR sinope $sin failed for $rawfile"
             com=$Fsinope
 #            comadd=
@@ -132,10 +136,13 @@
 case $check3 in 
    1)   echo " check3=$check3 -> everything ok -> set status..." >> $scriptlog 2>&1
+        printprocesslog "INFO finished fillsinope.C sucessfully for run $run"
         ;;
    0)   echo " check3=$check3 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
         check="no"
         setstatus "stop" >> $scriptlog 2>&1
         continue ;;
    *)   echo " check3=$check3 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+        printprocesslog "ERROR fillsinope.C failed for run $run"
         com=$Ffillsinope
         check=$check3
@@ -146,4 +153,5 @@
 # resetting the status for exclusions
 echo "resetting the status for fExclusionsDone for date $date2" >> $scriptlog 2>&1
+printprocesslog "INFO resetting fExclusions done for $date2"
 resetlogpath=$logpath/resetexclusions/$date
 makedir $resetlogpath >> $scriptlog 2>&1
@@ -153,10 +161,13 @@
 case $check5 in
    1)   echo " check5=$check5 -> everything ok, fExclusions have been reset " >> $scriptlog 2>&1
+        printprocesslog "INFO resetted fExclusions done for $date2 successfully"
         ;;
    0)   echo " check5=$check5 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
         check="no"
         setstatus "stop" >> $scriptlog 2>&1
         continue ;;
    *)   echo " check5=$check5 -> ERROR -> step could not be resetted -> repeat step " >> $scriptlog 2>&1
+        printprocesslog "ERROR resetcolumn.C failed for date $date2"
         com=$Fresetexcl
         comadd=`echo $date2 | sed -e 's/-//g'`
Index: trunk/MagicSoft/Mars/datacenter/scripts/doexclusions
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7944)
@@ -35,20 +35,16 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=doexclusions
-source `dirname $0`/sourcefile
+column=fExclusionsDone
 
 set -C
 
-column=fExclusionsDone
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if the script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -71,4 +67,5 @@
 do 
    echo "do exclusions for date "$date >> $scriptlog 2>&1
+   printprocesslog "INFO do exclusions for $date"
    year2=`echo $date | cut -c 1-4`
    var1=$year2
@@ -83,6 +80,13 @@
 
    case $check1 in
-      1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 ;;
+      1)   echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 
+           printprocesslog "INFO exclusions successfully done for $date"
+           ;;
+      0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
+           check="no"
+           ;;
       *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 
+           printprocesslog "ERROR $program.C failed"
            com=$Fdoexcl
            check=$check1
Index: trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots	(revision 7944)
@@ -33,6 +33,7 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=doqualityplots
-source `dirname $0`/sourcefile
 
 set -C
@@ -40,29 +41,28 @@
 cd $mars
 
-datetime=`date +%F-%H-%M-%S`
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/doqualityplots-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
-lockfile=$lockpath/lock-doqualityplots.txt
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
 # producing the plots with the values from the database 
 echo "producing plots: " >> $scriptlog 2>&1
+printprocesslog "INFO producing data quality plots"
 check0=`root -q -b $macrospath/plotdb.C+\(\) | tee -a $scriptlog | grep int | sed -e 's/.*(int)//'`
 
 case $check0 in 
-    1)   echo "check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1;;
-    *)   echo "check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1
-         rm -v $lockfile >> $scriptlog 2>&1 
-         exit;;
+    1)   echo " check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1
+         printprocesslog "INFO plots successfully produced"
+         ;;
+    *)   echo " check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1
+         printprocesslog "ERROR producing plots failed"
+         finish >> $scriptlog 2>&1
+         ;;
 esac
 
 # making files available in the web
+printprocesslog "INFO moving files to web"
 webpath=/www/htdocs/datacenter/datacheck
 name=plotdb
@@ -84,8 +84,10 @@
 # second part
 # making plots for all datasets
+printprocesslog "INFO producing plots for datasets"
 datasets=`find $datapath/ganymed -name ganymed*.root | grep -v summary`
 
 for dataset in ${datasets[@]}
 do 
+   printprocesslog "INFO producing plots for dataset $dataset"
    nr=`echo $dataset | cut -d/ -f6`
    nr2=`echo $nr | cut -c 1-5`
@@ -97,5 +99,5 @@
    rm -v $plotlog >> $scriptlog 2>&1
    check1=`root -q -b $macrospath/plotdb.C+\("\"$datasetfile\""\) 2>>$plotlog | tee -a $scriptlog | grep int | sed -e 's/.*(int)//'`
-   echo "check1: "$check1 >> $scriptlog 2>&1
+   echo " check1: "$check1 >> $scriptlog 2>&1
    newpsfile=$outpath/plotdb$nr.ps
    newrootfile=$outpath/plotdb$nr.root
@@ -106,8 +108,4 @@
 done
 
-rm -v $lockfile >> $scriptlog 2>&1 
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/dowebplots
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/dowebplots	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/dowebplots	(revision 7944)
@@ -32,20 +32,12 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=dowebplots
-source `dirname $0`/sourcefile
 
 set -C
 
-cd $mars
-
-datetime=`date +%F-%H-%M-%S`
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/dowebplots-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
-
 
 while getopts p: opts
@@ -65,11 +57,11 @@
    echo "usage: $(basename $0) -p programname"   >> $scriptlog 2>&1
    date  >> $scriptlog 2>&1
+   printprocesslog "INFO finished $0"
    exit
 fi
 
 # check if script is already running
-lockfile=$lockpath/lock-dowebplots-$type.txt
+lockfile=$lockpath/lock-$program-$type.txt
 checklock  >> $scriptlog 2>&1
-
 
 #finding all rootfiles in the data directory, that were modified in the last 3 days
@@ -81,11 +73,12 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
 
+cd $mars
+
 #produce plots for each rootfile
+printprocesslog "INFO procduing plots for each $type rootfile"
 for rootfile in ${rootfiles[@]}
 do 
@@ -120,4 +113,5 @@
    fi
 
+   printprocesslog "INFO procduing plots for $rootfile"
    echo "producing psfile..." >> $scriptlog 2>&1
    ./showplot -b --save-as-ps=$psfile $rootfile >> $scriptlog 2>&1
@@ -135,8 +129,4 @@
 done
 
-rm -v $lockfile >> $scriptlog 2>&1 
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 7944)
@@ -46,33 +46,26 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
+program=filesondisk
 
 set -C
 
-cd $mars
-
-program=filesondisk
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
-date=`date +%F`
+filesondisklogpath=$logpath/$program/`date +%Y/%m`
+makedir $filesondisklogpath >> $scriptlog 2>&1
 
-subsystemdir=/magic/subsystemdata
-filesondisklogpath=$logpath/$program/`date +%Y/%m`
-makedir $filesondisklogpath 
-
+cd $mars
 
 echo "checking disk for ccfiles..."  >> $scriptlog 2>&1
+printprocesslog "INFO checking ccfiles"
 filename=$filesondisklogpath/ccfilesondisk-$datetime.txt
 column=fCCFileAvail
-find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
+find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
 
 echo "resetting runs..." >> $scriptlog 2>&1
@@ -80,13 +73,21 @@
 
 case $check3 in 
-   1)   echo "check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
-   *)   echo "check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
+   1)   echo " check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1 
+        printprocesslog "INFO ccfiles resetted successfully"
+        ;;
+   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
+        ;;
+   *)   echo " check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 
+        printprocesslog "ERROR resettallruns.C failed for ccfiles"
+        ;;
 esac
 
 
 echo "checking disk for cacofiles..."  >> $scriptlog 2>&1 
+printprocesslog "INFO checking cacofiles"
 filename=$filesondisklogpath/cacofilesondisk-$datetime.txt
 column=fCaCoFileAvail
-find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
+find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
 
 echo "resetting runs..." >> $scriptlog 2>&1 
@@ -94,16 +95,33 @@
 
 case $check0 in 
-   1)   echo "check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
-   *)   echo "check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
+   1)   echo " check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1 
+        printprocesslog "INFO cacofiles resetted successfully"
+        ;;
+   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
+        ;;
+   *)   echo " check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 
+        printprocesslog "ERROR resettallruns.C failed for cacofiles"
+        ;;
 esac
 
+date=`date +%F`
 echo "checking missing cacofiles..." >> $scriptlog 2>&1 
+printprocesslog "INFO checking missing cacofiles"
 check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | grep int | sed -e 's/(int)//'`
 
 case $check1 in 
-   1)   echo "check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 ;;
-   *)   echo "check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
+   1)   echo " check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 
+        printprocesslog "INFO missing cacofiles found"
+        ;;
+   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
+        ;;
+   *)   echo " check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
+        printprocesslog "ERROR findcacofiles.C failed"
+        ;;
 esac
 
+printprocesslog "INFO finding missing cacofiles"
 missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
 for missingcacorun in ${missingcacoruns[@]}
@@ -112,5 +130,5 @@
    echo "missing cacofile for run "$runno >> $scriptlog 2>&1 
    echo "-> finding cacofile" >> $scriptlog 2>&1 
-   ccfile=`find $subsystemdir/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null
+   ccfile=`find $subsystempath/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null
    echo " ccfile: "$ccfile  >> $scriptlog 2>&1 
    if [ "$ccfile" = "" ]
@@ -129,10 +147,18 @@
          continue
       else
+         printprocesslog "INFO inserting cacofile for run $missingcacorun"
          echo " inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1 
          check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
 
          case $check2 in
-            1)   echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1 ;;
-            *)   echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1 ;;
+            1)   echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1 
+                 printprocesslog "INFO inserted $missingcacorun successfully"
+                 ;;
+            0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+                 printprocesslog "WARN connection to DB failed"
+                 ;;
+            *)   echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1 
+                 printprocesslog "ERROR insertcacofile.C failed for run $missingcacorun"
+                 ;;
          esac
          break
@@ -142,4 +168,5 @@
    then 
       echo " no cacofile found for run "$runno >> $scriptlog 2>&1 
+      printprocesslog "WARN no cacofile found for run $runno"
    else
       echo " cacofile: "$cacofile >> $scriptlog 2>&1 
@@ -149,7 +176,8 @@
 
 echo "checking disk for rawfiles..."  >> $scriptlog 2>&1 
+printprocesslog "INFO checking rawfiles"
 filename=$filesondisklogpath/rawfilesondisk-$datetime.txt
 column=fRawFileAvail
-find $datapath -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
+find $datapath/rawfiles -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
 
 echo "resetting runs..." >> $scriptlog 2>&1 
@@ -157,9 +185,15 @@
 
 case $check4 in 
-   1)   echo "check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;;
-   *)   echo "check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;;
+   1)   echo " check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1 
+        printprocesslog "INFO rawfiles resetted successfully"
+        ;;
+   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+        printprocesslog "WARN connection to DB failed"
+        ;;
+   *)   echo " check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 
+        printprocesslog "ERROR resettallruns.C failed for rawfiles"
+        ;;
 esac
 
 finish >> $scriptlog 2>&1
 
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 7944)
@@ -36,20 +36,16 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=fillcallisto
-source `dirname $0`/sourcefile
+column=fFillCallisto
 
 set -C
 
-column=fFillCallisto
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/run$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if the script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -71,4 +67,5 @@
 for sequence in ${sequences[@]}
 do 
+   printprocesslog "INFO starting $program for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
    no2=`printf %08d $sequence`
@@ -86,14 +83,19 @@
    setstatus "start" >> $scriptlog 2>&1
    echo "run fillcalib..." >> $scriptlog 2>&1
+   printprocesslog "INFO starting fillcalib for sequence $sequence"
 
    check1=`root -q -b $macrospath/fillcalib.C+\("\"$calibfile\""\,kFALSE\) | tee $fillcaliblog | grep int | sed -e 's/(int)//'`
 
    case $check1 in
-      1)   echo " check1=$check1 -> everything ok -> run fillsignal " >> $scriptlog 2>&1 ;;
+      1)   echo " check1=$check1 -> everything ok -> run fillsignal " >> $scriptlog 2>&1 
+           printprocesslog "INFO done fillcalib successfully for sequence $sequence"
+           ;;
       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            setstatus "stop" >> $scriptlog 2>&1
            continue ;;
       *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR fillcalib failed for sequence $sequence"
            com=$Ffillcalib
            check=$check1
@@ -102,11 +104,16 @@
    esac
 
+   printprocesslog "INFO starting fillsignal for sequence $sequence"
    check2=`root -q -b $macrospath/fillsignal.C+\("\"$signalfile\""\,kFALSE\) | tee $fillsignallog | grep int | sed -e 's/(int)//'`
    case $check2 in
-      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 ;;
+      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO done fillsignal successfully for sequence $sequence"
+           ;;
       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            ;;
       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR fillsignal failed for sequence $sequence"
            com=$Ffillsignal
            check=$check2
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillganymed	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillganymed	(revision 7944)
@@ -35,20 +35,16 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=fillganymed
-source `dirname $0`/sourcefile
+column=fFillGanymed
 
 set -C
 
-column=fFillGanymed
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/run$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -71,4 +67,5 @@
 for dataset in ${datasets[@]}
 do 
+   printprocesslog "INFO starting $program for dataset $dataset"
    no=`printf %08d $dataset | cut -c 0-5`
    no2=`printf %08d $dataset`
@@ -86,12 +83,16 @@
    check2=`root -q -b $macrospath/fillganymed.C+\("\"$ganymedfile\""\,kFALSE\) | tee $fillganymedlog | grep int | sed -e 's/(int)//'`
    case $check2 in
-      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 ;;
+      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO done fillganymed successfully for dataset $dataset"
+           ;;
       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            ;;
-      *)  echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
-          com=$Ffillganymed
-          check=$check2
-          ;;
+      *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR fillganymed failed for dataset $datset"
+           com=$Ffillganymed
+           check=$check2
+           ;;
    esac
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 7944)
@@ -35,25 +35,20 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=fillstar
-source `dirname $0`/sourcefile
+column=fFillStar
 
 set -C
 
-column=fFillStar
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/run$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if the script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
 # get todo list
 getdolist  >> $scriptlog 2>&1
-
 
 # retrieve sequences from todo file
@@ -72,4 +67,5 @@
 for sequence in ${sequences[@]}
 do 
+   printprocesslog "INFO starting $program for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
    no2=`printf %08d $sequence`
@@ -87,9 +83,13 @@
    check2=`root -q -b $macrospath/fillstar.C+\("\"$starfile\""\,kFALSE\) | tee $fillstarlog | grep \(int\) | sed -e 's/.*(int)//'`
    case $check2 in
-      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 ;;
+      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO done fillstar successfully for sequence $sequence"
+           ;;
       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            ;;
       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR fillstar failed for sequence $sequence"
            com=$Ffillstar
            check=$check2
Index: trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7944)
@@ -32,22 +32,15 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=insertdatasets
-source `dirname $0`/sourcefile
 
 set -C
 
-cd $mars
-
-datetime=`date +%F-%H-%M-%S`
-lockfile=$lockpath/lock-insertdatasets.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/insertdatasets-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -57,5 +50,8 @@
 echo "" >> $scriptlog 2>&1 
 
+cd $mars
+
 # extract information from dataset file and insert it into db with the macro insertdataset.C
+printprocesslog "INFO inserting dataset information into db"
 for datasetfile in ${datasetfiles[@]}
 do 
@@ -74,4 +70,5 @@
       echo "number in filename and in file are not the same " >> $scriptlog 2>&1 
       echo " -> continue with next dataset" >> $scriptlog 2>&1 
+      printprocesslog "ERROR number in filename and file are not the same for dataset $no2"
       continue
    fi
@@ -98,16 +95,21 @@
    insertdatasetlog=$insertdatasetpath/insertdataset-$no3.log
 
+   printprocesslog "INFO inserting dataset $no2"
    # insert information into db
    check0=`root -q -b $macrospath/insertdataset.C+\("\"$no2\""\,"\"$source\""\,"\"$wobble\""\,"\"$comment\""\,kFALSE\) | tee $insertdatasetlog | grep int | sed -e 's/(int)//'`
    case $check0 in 
-      1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 ;;
-      *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 ;;
+      1)   echo " check0=$check0 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO dataset $no2 successfully inserted"
+           ;;
+      0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
+           check="no"
+           ;;
+      *)   echo " check0=$check0 -> ERROR " >> $scriptlog 2>&1 
+           printprocesslog "ERROR $program.C failed for dataset $no2"
+           ;;
    esac
 done
 
-rm -v $lockfile >> $scriptlog 2>&1 
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/insertsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertsequences	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertsequences	(revision 7944)
@@ -33,23 +33,15 @@
 # 
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=insertsequences
-source `dirname $0`/sourcefile
 
 set -C
 
-cd $mars
-
-datetime=`date +%F-%H-%M-%S`
-year=`date +%Y`
-lockfile=$lockpath/lock-insertsequences.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-
-scriptlog=$scriptlogpath/insertsequences-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -61,25 +53,32 @@
 echo "" >> $scriptlog 2>&1 
 
+cd $mars
+
 # process sequencefiles: insert information into the database
 for sequencefile in ${sequencefiles[@]}
 do 
+   printprocesslog "INFO inserting sequence from file $sequencefile"
    echo "file: "$sequencefile >> $scriptlog 2>&1 
    no=`echo $sequencefile | cut -c 31-38`
-   no=`echo $no | cut -c 1-4`
-   insertsequencepath=$logpath/insertsequence/$no
+   no2=`echo $no | cut -c 1-4`
+   insertsequencepath=$logpath/$program/$no2
    makedir $insertsequencepath >> $scriptlog 2>&1
-   insertsequencelog=$insertsequencepath/insertsequence-$no.log
+   insertsequencelog=$insertsequencepath/$program-$no.log
 
    check0=`root -q -b $macrospath/insertsequence.C+\("\"$sequencefile\""\,kFALSE\) | tee $insertsequencelog | grep int | sed -e 's/(int)//'`
    case $check0 in 
-      1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 ;;
-      *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 ;;
+      1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO sequence $no2 successfully inserted"
+           ;;
+      0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
+           check="no"
+           ;;
+      *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 
+           printprocesslog "ERROR $program.C failed for sequence $no2"
+           ;;
    esac
 done
 
-rm -v $lockpath/lock-insertsequences.txt >> $scriptlog 2>&1 
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/jobmanager
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/jobmanager	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/jobmanager	(revision 7944)
@@ -31,5 +31,5 @@
 
 source `dirname $0`/sourcefile
-user=`whoami`
+printprocesslog "INFO starting $0"
 
 set -C
@@ -42,4 +42,5 @@
 
 prev=$max
+user=`whoami`
 notcount=0
 while (( $notcount < 100 ))
@@ -117,4 +118,5 @@
          nail -s 'condor problem'  $erradrs < $jmerrorlog
          echo "condor is not working -> sleeping $errorsleeptime" >> $jmscriptlog 2>&1
+         printprocesslog "ERROR submitting ${scripts[$i]} to condor failed"
          sleep $errorsleeptime
       fi
Index: trunk/MagicSoft/Mars/datacenter/scripts/linkmc
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/linkmc	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/linkmc	(revision 7944)
@@ -42,17 +42,15 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=linkmc
-source `dirname $0`/sourcefile
 
 set -C
 
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/linkmc`date +%F`.log
-
+scriptlog=$runlogpath/$progam-`date +%F`.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
-lockfile=$lockpath/lock-mclinks.txt
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -67,6 +65,6 @@
 then
    echo "file $next not found -> no start-runno -> exit" >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   exit
+   printprocesslog "ERROR file $next (last runno) not found"
+   finish >> $scriptlog 2>&1
 fi
 
@@ -116,4 +114,5 @@
 camfiles=`find $mccampath -type f | grep -v Cal_and_Ped`
 
+printprocesslog "INFO linking new camerafiles starting with runno $runno"
 for camfile in ${camfiles[@]}
 do 
@@ -123,4 +122,5 @@
       continue
    fi
+   printprocesslog "INFO linking $file"
    file=`basename $camfile` #filename
    no=`printf %08d $runno | cut -c 0-5` #first 5 digits of a 8digit runno -> for path
@@ -177,4 +177,5 @@
 done
 
+printprocesslog "INFO linking cal and ped files"
 echo "linking cal and ped file" >> $scriptlog 2>&1
 #get files
@@ -188,6 +189,6 @@
 then 
    "too many files in the directory $mccampath/Cal_and_Ped -> exit" >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   exit
+   printprocesslog "ERROR too many ped and cal files found in $mccampath/Cal_and_Ped"
+   finish >> $scriptlog 2>&1
 fi
 
@@ -225,8 +226,4 @@
 done
 
-rm -v $lockfile >> $scriptlog 2>&1
-
-set +C
-
-date  >> $scriptlog 2>&1
-
+finish >> $scriptlog 2>&1
+
Index: trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks	(revision 7944)
@@ -33,16 +33,12 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=makecallistolinks
-source `dirname $0`/sourcefile
+column=fCallisto
 
 set -C
 
-callistorcseq=callisto.rc
-callistorcnew=callisto_Dec04Jan05.rc
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program`date +%F`.log
-
+scriptlog=$runlogpath/$program`date +%F`.log
 date >> $scriptlog 2>&1
 
@@ -51,4 +47,6 @@
 checklock  >> $scriptlog 2>&1
 
+callistorcseq=callisto.rc
+callistorcnew=callisto_Dec04Jan05.rc
 # reason why calibration with standard callisto.rc fails
 reason1="Pulse is too much to the right, cannot go beyond logain limits!"
@@ -60,13 +58,11 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
+   finish >> $scriptlog 2>&1
 fi
-
-column=fCallisto
-table=SequenceProcessStatus
 
 cd $mars
 
 # make links for callisto.rc for which the callisto.log contains reason
+printprocesslog "INFO linking callisto.rc files"
 for file in $files
 do 
@@ -80,4 +76,5 @@
       if ! ls -l $callistorc | grep $callistorcnew >> $scriptlog 2>&1
       then 
+         printprocesslog "INFO linking $callistorcnew to $callistorc for sequ $sequ"
          # resetting the calibration
          echo "resetting the callisto for sequence $sequ" >> $scriptlog 2>&1
@@ -90,7 +87,14 @@
          case $check1 in
             1)   echo " check1=$check1 -> everything ok, callisto has been reset " >> $scriptlog 2>&1
+                 printprocesslog "INFO resetted calibration successfully for sequence $sequ"
+                 ;;
+            0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+                 printprocesslog "WARN connection to DB failed"
+                 check="no"
                  ;;
             *)   echo " check1=$check1 -> ERROR -> step could not be resetted -> continue " >> $scriptlog 2>&1
-                 continue ;;
+                 printprocesslog "ERROR resetcolumn.C failed for fCallisto for sequ $sequ"
+                 continue 
+                 ;;
          esac
          #linking callisto.rc
@@ -100,8 +104,4 @@
 done
 
-rm -v $lockfile >> $scriptlog 2>&1
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/mcsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/mcsequences	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/mcsequences	(revision 7944)
@@ -34,13 +34,11 @@
 # 
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=mcsequences
-source `dirname $0`/sourcefile
 
 set -C
 
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program`date +%F`.log
-
+scriptlog=$runlogpath/$program`date +%F`.log
 date >> $scriptlog 2>&1
 
@@ -49,9 +47,9 @@
 checklock  >> $scriptlog 2>&1
 
-
 mcpath=/montecarlo/rawfiles
 mcsequpath=/montecarlo/sequences
 
 # find montecarlo directories, build one sequence per directory and write sequence file
+printprocesslog "INFO building one sequence per mcdirectory"
 dirs=`find $mcpath -type d`
 for dir in ${dirs[@]}
@@ -83,4 +81,5 @@
    sequfile=$sequpath/sequence$no2.txt
    echo "writing sequfile "$sequfile >> $scriptlog 2>&1
+   printprocesslog "INFO writing sequencefile $sequfile"
    
    echo "Sequence:        $firstrun" > $sequfile
@@ -93,9 +92,4 @@
 done
 
+finish >> $scriptlog 2>&1
 
-rm -v $lockfile >> $scriptlog 2>&1
-
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles	(revision 7944)
@@ -31,22 +31,16 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
+program=movingrawfiles
 
 set -C
+umask 0002
 
-program=movingrawfiles
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
-
-
-umask 0002
 
 # change permission for files 
@@ -54,4 +48,5 @@
 # output for chmod with -v or -c (only changes)
 
+printprocesslog "INFO moving directories from fromlapalma to fromtape"
 #find directories, which have to be copied
 dirs=`ls /magic/datacenter/fromlapalma/RAWchk/*/*.finished | sed -e 's/RAWchk/RAW/g' | cut -d/ -f1-6`
@@ -74,4 +69,5 @@
 fi
 
+printprocesslog "INFO moving moving rawfiles to $datapath/rawfiles"
 for rawfile in $rawfiles
 do 
@@ -87,4 +83,5 @@
 rmdir -v /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1 
 
+printprocesslog "INFO launching filesondisk"
 echo "launching filesondisk" >> $scriptlog 2>&1 
 $scriptspath/filesondisk&
Index: trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences	(revision 7944)
@@ -32,13 +32,11 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=processmcsequences
-source `dirname $0`/sourcefile
 
 set -C
 
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/$program`date +%F-%H-%M-%S`.log
-
+scriptlog=$runlogpath/$program`date +%F-%H-%M-%S`.log
 date >> $scriptlog 2>&1
 
@@ -56,4 +54,5 @@
 
 # find montecarlo sequence files
+printprocesslog "INFO processing mc sequences"
 sequfiles=`find $mcsequpath -type f`
 for sequfile in ${sequfiles[@]}
@@ -95,5 +94,6 @@
    # if calibration worked -> run star for sequence
    case $check1 in
-      0)   echo "check1=$check1 -> everything ok..." >> $scriptlog 2>&1
+      0)   echo " check1=$check1 -> everything ok..." >> $scriptlog 2>&1
+           printprocesslog "INFO calibrated mc sequende $sequno successfully"
            touch $caloutpath/.done
            rm $caloutpath/.doing
@@ -105,19 +105,19 @@
            
            case $check2 in 
-              0)   echo "check2=$check2 -> everything ok..." >> $scriptlog 2>&1
+              0)   echo " check2=$check2 -> everything ok..." >> $scriptlog 2>&1
+                   printprocesslog "INFO run star successfully for mc sequende $sequno"
                    touch $imgoutpath/.done
                    ;;
-              *)   echo "check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+              *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+                   printprocesslog "ERROR star failed for mc sequende $sequno"
                    ;;
            esac
     	   ;;
-      *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
+      *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR callisto failed for mc sequende $sequno"
+           ;;
    esac
 done
 
-rm -v $lockfile >> $scriptlog 2>&1
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/rmlocks
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/rmlocks	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/rmlocks	(revision 7944)
@@ -38,4 +38,5 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 
 files=`ls $lockpath/*`
@@ -49,4 +50,5 @@
    if [ $compdate -gt $filedate ]
    then 
+      printprocesslog "INFO removing file $file"
       rm -v $file
       echo "date:  "$filedate
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7944)
@@ -37,20 +37,12 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=callisto
-source `dirname $0`/sourcefile
+column=fCallisto
 
 set -C
 
-# define callisto.rc files
-callistorcnew=$setuppath/$program/callisto.rc
-callistorcmarapr05=$setuppath/$program/callisto_MarApr05.rc
-
-column=fCallisto
-#pno=500 # number of processes, i.e. number of todo-files
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/run$program-$datetime.log
 date >> $scriptlog 2>&1
 
@@ -67,4 +59,5 @@
 # run calibration for sequence
 echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
+printprocesslog "INFO starting $program for sequence $sequence"
 no=`printf %08d $sequence | cut -c 0-4`
 no2=`printf %08d $sequence`
@@ -73,7 +66,9 @@
 outpath="$datapath/$program/$no/$no2"
 makedir $outpath >> $scriptlog 2>&1
-
 sequfile="$sequpath/$no/sequence$no2.txt"
 
+# define callisto.rc files
+callistorcnew=$setuppath/$program/callisto.rc
+callistorcmarapr05=$setuppath/$program/callisto_MarApr05.rc
 # find callisto.rc file
 if [ -e $outpath/callisto.rc ]
@@ -99,4 +94,5 @@
 case $check1 in
    0)   echo " check1=$check1 -> everything ok -> doing update..." >> $scriptlog 2>&1
+        printprocesslog "INFO $program finished successfully for sequence $sequence"
         # running merpp update if calibration worked
         # finding files, which have to be updated
@@ -113,4 +109,5 @@
         makedir $merpplogpath >> $scriptlog 2>&1
         
+        printprocesslog "INFO doing merppupdate for sequence $sequence"
         # updated calibrated data files with the information from the cc and caco files
         for calfile in ${calfiles[@]}
@@ -127,4 +124,5 @@
            then
               echo "no ccfile found for run "$runno >> $scriptlog 2>&1
+              printprocesslog "ERROR  no ccfile found for $calfile"
               com=$Fnoccfile
               comadd=$runno
@@ -163,6 +161,9 @@
            check2=$?
            case $check2 in
-                   0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1;;
-       	     *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
+                   0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1
+                        printprocesslog "INFO merppupdated $calfile sucessfully with $ccfile"
+                        ;;
+        	   *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
+                        printprocesslog "ERROR merppccupdate failed for $calfile"
                         com=$Fmerppcc
                         comadd=$runno
@@ -173,6 +174,9 @@
            check3=$?
            case $check3 in
-                   0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1;;
-       	     *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
+                   0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1
+                        printprocesslog "INFO merppupdated $calfile sucessfully with $cacofile"
+                        ;;
+        	   *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
+                        printprocesslog "ERROR merppcacoupdate failed for $calfile"
                         com=$Fmerppcaco
                         comadd=$runno
@@ -183,4 +187,5 @@
 	  ;;
    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+        printprocesslog "ERROR $program failed for sequence $sequence"
         com=$Fcallisto
         check=$check1
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7944)
@@ -37,15 +37,12 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=ganymed
-source `dirname $0`/sourcefile
+column=fGanymed
 
 set -C
 
-column=fGanymed
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/run$program-$datetime.log
 date >> $scriptlog 2>&1
 
@@ -61,4 +58,5 @@
 
 echo "run $program for dataset $dataset..." >> $scriptlog 2>&1
+printprocesslog "INFO starting $program for dataset $dataset"
 no=`printf %08d $dataset | cut -c 0-5`
 no2=`printf %08d $dataset`
@@ -86,6 +84,9 @@
 
 case $check1 in
-   0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1 ;;
+   0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1 
+        printprocesslog "INFO $program finished successfully for dataset $dataset"
+        ;;
    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+        printprocesslog "ERROR $program failed for dataset $dataset"
         com=$Fganymed
         check=$check1
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7944)
@@ -37,15 +37,12 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=star
-source `dirname $0`/sourcefile
+column=fStar
 
 set -C
 
-column=fStar
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/run$program-$datetime.log
 date >> $scriptlog 2>&1
 
@@ -61,4 +58,5 @@
 
 echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
+printprocesslog "INFO starting $program for sequence $sequence"
 no=`printf %08d $sequence | cut -c 0-4`
 no2=`printf %08d $sequence`
@@ -77,6 +75,9 @@
 
 case $check1 in
-   0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1;;
+   0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
+        printprocesslog "INFO $program finished successfully for sequence $sequence"
+        ;;
    *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+        printprocesslog "ERROR $program failed for sequence $sequence"
         com=$Fstar
         check=$check1
Index: trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher	(revision 7944)
@@ -18,5 +18,5 @@
 #
 #
-#   Author(s): Daniela Dorner  05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
+#   Author(s): Daniela Dorner  08/2006 <mailto:dorner@astro.uni-wuerzburg.de>
 #
 #   Copyright: MAGIC Software Development, 2000-2006
@@ -29,12 +29,11 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0 $@"
 
 makedir $listpath
 makedir $lockpath
 
-sllogpath=$logpath/scriptlauncher/`date +%Y/%m`
-makedir $sllogpath
-errorlog=$sllogpath/error`date +%F`.log
-scriptlog=$sllogpath/scriptlauncher`date +%F`.log
+errorlog=$runlogpath/scriptlauncher-error`date +%F`.log
+scriptlog=$runlogpath/scriptlauncher`date +%F`.log
 
 echo `date`": starting $0 $@"  >> $scriptlog 2>&1
@@ -53,5 +52,9 @@
    fi
    echo " launching $i..." >> $scriptlog 2>&1
-   pid=`/usr/local/bin/condor_submit -a path=$path -a prog=$i -a date=$date2 -a dir=$condordir $path/run.condor | grep cluster | cut -dr -f2`  2>$errorlog
+   if ! pid=`/usr/local/bin/condor_submit -a path=$path -a prog=$i -a date=$date2 -a dir=$condordir $path/run.condor | grep cluster | cut -dr -f2`  2>$errorlog
+   then 
+      echo "condor is not working " >> $errorlog 2>&1
+      printprocesslog "ERROR submitting $i to condor failed"
+   fi
    if ! echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog
    then
@@ -63,2 +66,4 @@
 echo "" >> $scriptlog 2>&1
 
+printprocesslog "INFO finished $0 $@"
+
Index: trunk/MagicSoft/Mars/datacenter/scripts/setup
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/setup	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/setup	(revision 7944)
@@ -34,5 +34,4 @@
 
 logpath=/magic/datacenter/autologs
-runlogpath=/magic/datacenter/autologs/run/`date +%Y/%m/%d`
 lockpath=/magic/datacenter/locks
 listpath=/magic/datacenter/lists
@@ -43,4 +42,5 @@
 sequpath=/magic/sequences
 datasetpath=/magic/datasets
+
 
 webpath=/www/htdocs/datacenter
@@ -56,9 +56,4 @@
 errorsleeptime=180 #180
 max=16 #maximum number of processes
-#log files (can't be defined in script itself, as script can run longer 
-#than one day
-jmlogpath=$logpath/jobmanager/`date +%Y/%m`
-jmerrorlog=$jmlogpath/error`date +%F`.log
-jmscriptlog=$jmlogpath/jobmanager`date +%F`.log
 
 scripts=( "runcallisto" "runstar" "runganymed" "dodatacheck" ) 
@@ -66,15 +61,15 @@
 
 #hour:            0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
-pnototal=(       16 16 16 16 16 16 16 12 12 12 10 10 10 12 12 12 12 12 12 14 16 16 16 16 )
+pnototal=(       16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 )
 pnototalwe=(     16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 )
 
-pnocallisto=(     8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8 )
-pnostar=(         8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8 )
-pnoganymed=(      3  3  3  3  3  3  3  2  2  2  1  1  2  2  1  1  1  1  1  2  2  3  3  3 )
+pnocallisto=(    12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 )
+pnostar=(         5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5 )
+pnoganymed=(      2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 )
 pnodatacheck=(   16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 )
 
-pnocallistowe=(  10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 )
-pnostarwe=(      10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 )
-pnoganymedwe=(    3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3 )
+pnocallistowe=(  12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 )
+pnostarwe=(       5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5 )
+pnoganymedwe=(    2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 )
 pnodatacheckwe=( 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 )
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7943)
+++ 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
+
+}
Index: trunk/MagicSoft/Mars/datacenter/scripts/webupdate-callisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/webupdate-callisto	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/webupdate-callisto	(revision 7944)
@@ -29,21 +29,23 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 
-date
+scriptlog=$runlogpath/webupdate-callisto-$datetime.log
+date >> $scriptlog 2>&1
 
-echo "do plots for all root-files (callisto) ..."
+echo "do plots for all root-files (callisto) ..." >> $scriptlog 2>&1
 $scriptspath/dowebplots -p callisto
 
+echo "do rsync for callisto files" >> $scriptlog 2>&1
+rsync -av --delete --exclude=*/*/*_E[.]root --exclude=*/*/callisto.rc $datapath/callisto/ $webpath/callisto >> $scriptlog 2>&1
 
-echo "do rsync for callisto files"
-rsync -av --delete --exclude=*/*/*_E[.]root --exclude=*/*/callisto.rc $datapath/callisto/ $webpath/callisto
+echo "do rsync for subsystem files" >> $scriptlog 2>&1
+rsync -av --delete /magic/subsystemdata/ $webpath/subsystemdata >> $scriptlog 2>&1
 
-#echo "do rsync for subsystem files"
-rsync -av --delete /magic/subsystemdata/ $webpath/subsystemdata
+echo "do rsync for sequence files" >> $scriptlog 2>&1
+rsync -av --delete /magic/sequences/ $webpath/sequences >> $scriptlog 2>&1
 
-echo "do rsync for sequence files"
-rsync -av --delete /magic/sequences/ $webpath/sequences
+date >> $scriptlog 2>&1
 
-date
+printprocesslog "INFO $0 finished"
 
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/webupdate-ganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/webupdate-ganymed	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/webupdate-ganymed	(revision 7944)
@@ -29,17 +29,20 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 
-date
+scriptlog=$runlogpath/webupdate-ganymed-$datetime.log
+date >> $scriptlog 2>&1
 
-echo "do plots for all root-files (ganymed) ..."
+echo "do plots for all root-files (ganymed) ..." >> $scriptlog 2>&1
 $scriptspath/dowebplots -p ganymed
 
-echo "do rsync for ganymed files"
-rsync -av --delete $datapath/ganymed/ $webpath/ganymed
+echo "do rsync for ganymed files" >> $scriptlog 2>&1
+rsync -av --delete $datapath/ganymed/ $webpath/ganymed >> $scriptlog 2>&1
 
-echo "do rsync for dataset files"
-rsync -av --delete /magic/datasets/ $webpath/datasets
+echo "do rsync for dataset files" >> $scriptlog 2>&1
+rsync -av --delete /magic/datasets/ $webpath/datasets >> $scriptlog 2>&1
 
-date
+date >> $scriptlog 2>&1
 
+printprocesslog "INFO $0 finished"
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/webupdate-sinope
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/webupdate-sinope	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/webupdate-sinope	(revision 7944)
@@ -28,14 +28,17 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 
-date
+scriptlog=$runlogpath/webupdate-sinope-$datetime.log
+date >> $scriptlog 2>&1
 
-echo "do plots for all root-files (sinope) ..."
-$scriptspath/dowebplots -p sinope
+echo "do plots for all root-files (sinope) ..." >> $scriptlog 2>&1
+$scriptspath/dowebplots -p sinope >> $scriptlog 2>&1
 
-echo "do rsync for sinope files"
-rsync -av --delete $datapath/sinope/ $webpath/sinope
+echo "do rsync for sinope files" >> $scriptlog 2>&1
+rsync -av --delete $datapath/sinope/ $webpath/sinope >> $scriptlog 2>&1
 
-date
+date >> $scriptlog 2>&1
 
+printprocesslog "INFO $0 finished"
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/webupdate-star
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/webupdate-star	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/webupdate-star	(revision 7944)
@@ -29,20 +29,23 @@
 
 source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 
-date
+scriptlog=$runlogpath/webupdate-star-$datetime.log
+date >> $scriptlog 2>&1
 
-echo "do plots for all root-files (star) ... "
+echo "do plots for all root-files (star) ... " >> $scriptlog 2>&1
 $scriptspath/dowebplots -p star
 
-echo "do rsync for star files"
-rsync -av --delete --exclude=*/*/*_E[.]root $datapath/star/ $webpath/star
+echo "do rsync for star files" >> $scriptlog 2>&1
+rsync -av --delete --exclude=*/*/*_E[.]root $datapath/star/ $webpath/star >> $scriptlog 2>&1
 
-echo "do rsync for star files from la palma"
-rsync -av --delete --exclude=*/*_E[.]root --exclude=*/Time*.dat /scratch/lapalma/star/ $webpath/star_lapalma
+echo "do rsync for star files from la palma" >> $scriptlog 2>&1
+rsync -av --delete --exclude=*/*_E[.]root --exclude=*/Time*.dat /scratch/lapalma/star/ $webpath/star_lapalma >> $scriptlog 2>&1
 
-echo "do rsync for sequence files"
-rsync -av --delete /magic/sequences/ $webpath/sequences
+echo "do rsync for sequence files" >> $scriptlog 2>&1
+rsync -av --delete /magic/sequences/ $webpath/sequences >> $scriptlog 2>&1
 
-date
+date >> $scriptlog 2>&1
 
+printprocesslog "INFO $0 finished"
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7943)
+++ trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7944)
@@ -35,20 +35,16 @@
 #
 
+source `dirname $0`/sourcefile
+printprocesslog "INFO starting $0"
 program=writesequencefile
-source `dirname $0`/sourcefile
+column=fSequenceFileWritten
 
 set -C
 
-column=fSequenceFileWritten
-
-lockfile=$lockpath/lock-$program.txt
-
-scriptlogpath=$runlogpath/$program
-makedir $scriptlogpath
-scriptlog=$scriptlogpath/run$program-$datetime.log
-
+scriptlog=$runlogpath/$program-$datetime.log
 date >> $scriptlog 2>&1
 
 # check if script is already running
+lockfile=$lockpath/lock-$program.txt
 checklock  >> $scriptlog 2>&1
 
@@ -71,4 +67,5 @@
 for sequence in ${sequences[@]}
 do 
+   printprocesslog "INFO write sequence files for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
    no2=`printf %08d $sequence`
@@ -87,9 +84,13 @@
    check2=`root -q -b $macrospath/writesequencefile.C+\($sequence\,"\"$sequpath\""\) | tee $writesequencefilelog | grep int | sed -e 's/(int)//'`
    case $check2 in
-      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 ;;
+      1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 
+           printprocesslog "INFO sequence file successfully written for sequence $sequence"
+           ;;
       0)   echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+           printprocesslog "WARN connection to DB failed"
            check="no"
            ;;
       *)   echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+           printprocesslog "ERROR $program.C failed for sequence $sequence"
            com=$Fwritesequfile
            check=$check2
