Index: trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 7486)
@@ -57,14 +57,5 @@
 
 # check if script is already running
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 7486)
@@ -55,14 +55,5 @@
 
 # check if script is already running
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkstardone
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 7486)
@@ -56,14 +56,5 @@
 
 # check if script is already running
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
Index: trunk/MagicSoft/Mars/datacenter/scripts/copyscript
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7486)
@@ -58,4 +58,5 @@
 
 user=`whoami`
+program=copyscript
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -77,14 +78,5 @@
 
 # check if the script is already running
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> copyscript is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 cd $transdir
Index: trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck	(revision 7486)
@@ -52,4 +52,5 @@
 
 todofile=$listpath/ToDo-$table-$column
+lockfile=$lockpath/lock-getting-$program-list.txt
 
 scriptlogpath=$logpath/run/$program/`date +%Y/%m`
@@ -66,19 +67,9 @@
    echo " -> choose one file and start $program " >> $scriptlog 2>&1
 else
-   date > $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1 
-   checklock0=$?
-   case $checklock0 in 
-       0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-       1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-            echo "-> getting list for $program is running -> exit" >> $scriptlog 2>&1
-            date  >> $scriptlog 2>&1
-            exit;;
-       *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-   esac
-
+   # check if getting of list is already running
+   checklock "getting list of" >> $scriptlog 2>&1
    # get todo list
    getdolist  >> $scriptlog 2>&1
-
-   rm -v $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
+   rm -v $lockfile >> $scriptlog 2>&1
 fi
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/doexclusions
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7486)
@@ -57,14 +57,5 @@
 
 # check if the script is already running
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> getting list for $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
Index: trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots	(revision 7486)
@@ -34,4 +34,5 @@
 
 user=`whoami`
+program=doqualityplots
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -51,14 +52,5 @@
 # check if script is already running
 lockfile=$lockpath/lock-doqualityplots.txt
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> for datacheck is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # producing the plots with the values from the database 
Index: trunk/MagicSoft/Mars/datacenter/scripts/dowebplots
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/dowebplots	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/dowebplots	(revision 7486)
@@ -33,4 +33,5 @@
 
 user=`whoami`
+program=dowebplots
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -51,15 +52,5 @@
 # check if script is already running
 lockfile=$lockpath/lock-dowebplots.txt
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> for datacheck is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
-
+checklock  >> $scriptlog 2>&1
 
 #finding all rootfiles in the webdirectory 
Index: trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 7486)
@@ -132,5 +132,5 @@
 filename=$filesondisklogpath/rawfilesondisk-$date.txt
 column=fRawFileAvail
-find $datapath -name '*.raw' | cut -d_ -f2 > $filename
+find $datapath -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
 
 echo "resetting runs..."                                    
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 7486)
@@ -58,14 +58,5 @@
 
 # check if the script is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo file
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillganymed	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillganymed	(revision 7486)
@@ -57,14 +57,5 @@
 
 # check if script is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 7486)
@@ -57,14 +57,5 @@
 
 # check if the script is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
Index: trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7486)
@@ -33,4 +33,5 @@
 
 user=`whoami`
+program=insertdatasets
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -40,4 +41,5 @@
 
 datetime=`date +%F-%H-%M-%S`
+lockfile=$lockpath/lock-insertdatasets.txt
 
 scriptlogpath=$logpath/run/insertdatasets/`date +%Y/%m`
@@ -48,14 +50,6 @@
 date >> $scriptlog 2>&1
 
-date > $lockpath/lock-insertdatasets.txt >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> insertdatasets is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+# check if script is already running
+checklock  >> $scriptlog 2>&1
 
 # get all datasetfiles
@@ -112,5 +106,5 @@
 done
 
-rm -v $lockpath/lock-insertdatasets.txt >> $scriptlog 2>&1 
+rm -v $lockfile >> $scriptlog 2>&1 
 
 set +C
Index: trunk/MagicSoft/Mars/datacenter/scripts/insertsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertsequences	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertsequences	(revision 7486)
@@ -34,4 +34,5 @@
 
 user=`whoami`
+program=insertsequences
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -51,14 +52,5 @@
 
 # check if script is already running
-date > $lockpath/lock-insertsequences.txt >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> insertsequences is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # finding manual written sequence files (marked by the comment '#manually changed')
Index: trunk/MagicSoft/Mars/datacenter/scripts/linkmc
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/linkmc	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/linkmc	(revision 7486)
@@ -43,4 +43,5 @@
 
 user=`whoami`
+program=linkmc
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -55,14 +56,5 @@
 # check if script is already running
 lockfile=$lockpath/lock-mclinks.txt
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> linkmc is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 mccampath=/montecarlo/camera
Index: trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks	(revision 7486)
@@ -50,14 +50,5 @@
 # check if script is already running
 lockfile=$lockpath/lock-$program.txt
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # reason why calibration with standard callisto.rc fails
Index: trunk/MagicSoft/Mars/datacenter/scripts/mcsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/mcsequences	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/mcsequences	(revision 7486)
@@ -35,26 +35,18 @@
 
 user=`whoami`
+program=mcsequences
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
 set -C
 
-scriptlogpath=$logpath/run/mcsequences/`date +%Y/%m/%d`
+scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
 makedir $scriptlogpath
-scriptlog=$scriptlogpath/mcsequences`date +%F`.log
+scriptlog=$scriptlogpath/$program`date +%F`.log
 
 date >> $scriptlog 2>&1
 
 # check if script is already running
-lockfile=$lockpath/lock-mcsequences.txt
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> linkmc is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+lockfile=$lockpath/lock-$program.txt
+checklock  >> $scriptlog 2>&1
 
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences	(revision 7486)
@@ -33,26 +33,18 @@
 
 user=`whoami`
+program=processmcsequences
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
 set -C
 
-scriptlogpath=$logpath/run/processmcsequences/`date +%Y/%m/%d`
+scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
 makedir $scriptlogpath
-scriptlog=$scriptlogpath/processmcsequences`date +%F-%H-%M-%S`.log
+scriptlog=$scriptlogpath/$program`date +%F-%H-%M-%S`.log
 
 date >> $scriptlog 2>&1
 
 # check if script is already running
-lockfile=$lockpath/lock-processmcsequences.txt
-date > $lockfile >> $scriptlog 2>&1 
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> processmcsequences is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+lockfile=$lockpath/lock-$program.txt
+checklock  >> $scriptlog 2>&1
 
 mcpath=/montecarlo/rawfiles
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7486)
@@ -62,16 +62,4 @@
 cd $mars
 
-# check if getting of list is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> getting list for $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
-
 # get todo file
 echo "checking if other todo-files are there" >> $scriptlog 2>&1
@@ -81,4 +69,6 @@
    echo " -> choose one file and start calibrating" >> $scriptlog 2>&1
 else
+   # check if getting of list is already running
+   checklock "getting list of" >> $scriptlog 2>&1
    # get todo list
    getdolist  >> $scriptlog 2>&1
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7486)
@@ -58,16 +58,4 @@
 cd $mars
 
-# check if getting of list is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> getting list for $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
-
 # finding todo file
 echo "checking if other todo-files are there" >> $scriptlog 2>&1
@@ -77,4 +65,6 @@
    echo " -> choose one file and run $program" >> $scriptlog 2>&1
 else
+   # check if getting of list is already running
+   checklock "getting list of" >> $scriptlog 2>&1
    # get todo list
    getdolist  >> $scriptlog 2>&1
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7486)
@@ -58,16 +58,4 @@
 cd $mars
 
-# check if getting of list is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> getting list for $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
-
 # finding todo file
 echo "checking if other todo-files are there" >> $scriptlog 2>&1
@@ -77,4 +65,6 @@
    echo " -> choose one file and start calculation of image parameter" >> $scriptlog 2>&1
 else
+   # check if getting of list is already running
+   checklock "getting list of" >> $scriptlog 2>&1
    # get todo list
    getdolist  >> $scriptlog 2>&1
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7486)
@@ -100,4 +100,18 @@
 }
 
+function checklock()
+{ 
+   date > $lockfile
+   checklock0=$?
+   case $checklock0 in 
+       0)   echo "checklock0=$checklock0 -> continue " ;;
+       1)   echo "checklock0=$checklock0 -> file $lockfile exists "
+            echo "-> $@ $program is running -> exit"
+            date 
+            exit;;
+       *)   echo "checklock0=$checklock0 -> something went completely wrong" ;;
+   esac
+}
+
 function getdolist()
 {
@@ -162,5 +176,8 @@
                       returncode=$check
                       failedcode=$com
-                      failedcodeadd=$comadd
+                      if ! [ "$comadd" = "" ]
+                      then 
+                         failedcodeadd=$comadd
+                      fi
                       failedtime="Now()"
                       ;;
Index: trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7483)
+++ trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7486)
@@ -57,14 +57,5 @@
 
 # check if script is already running
-date > $lockfile >> $scriptlog 2>&1
-checklock0=$?
-case $checklock0 in 
-    0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
-    1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> $program is running -> exit" >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-    *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
-esac
+checklock  >> $scriptlog 2>&1
 
 # get todo list
