Index: trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks	(revision 7477)
@@ -34,4 +34,5 @@
 
 user=`whoami`
+program=makecallistolinks
 source /home/$user/Mars/datacenter/scripts/sourcefile
 
@@ -41,12 +42,12 @@
 callistorcnew=callisto_Dec04Jan05.rc
 
-scriptlogpath=$logpath/run/makecallistolinks/`date +%Y/%m/%d`
+scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
 makedir $scriptlogpath
-scriptlog=$scriptlogpath/makingcallistolinks`date +%F`.log
+scriptlog=$scriptlogpath/$program`date +%F`.log
 
 date >> $scriptlog 2>&1
 
 # check if script is already running
-lockfile=$lockpath/lock-making-callisto-links.txt
+lockfile=$lockpath/lock-$program.txt
 date > $lockfile >> $scriptlog 2>&1 
 checklock0=$?
@@ -54,5 +55,5 @@
     0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
     1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
-         echo "-> makecallistolinks is running -> exit" >> $scriptlog 2>&1
+         echo "-> $program is running -> exit" >> $scriptlog 2>&1
          date  >> $scriptlog 2>&1
          exit;;
Index: trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences	(revision 7477)
@@ -50,5 +50,5 @@
     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
+         echo "-> processmcsequences is running -> exit" >> $scriptlog 2>&1
          date  >> $scriptlog 2>&1
          exit;;
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7477)
@@ -49,12 +49,8 @@
 table=SequenceProcessStatus
 column=fCallisto
-date=NULL
-datetime=`date +%F-%H-%M-%S`
-year=`date +%Y`
 #pno=500 # number of processes, i.e. number of todo-files
 
 todofile=$listpath/ToDo-$table-$column
-getstatuslogpath=$logpath/getstatus/$program/$year
-getstatuslog=$getstatuslogpath/getstatus-$program-$datetime.log
+lockfile=$lockpath/lock-getting-$program-list.txt
 
 scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
@@ -64,7 +60,17 @@
 date >> $scriptlog 2>&1
 
-makedir $getstatuslogpath >> $scriptlog 2>&1
-
 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
@@ -75,26 +81,7 @@
    echo " -> choose one file and start calibrating" >> $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
-
-   echo "getting list..." >> $scriptlog 2>&1
-   check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
-
-   case $check0 in
-      1)   echo "check0=$check0 -> everything ok -> run $program" >> $scriptlog 2>&1;;
-      *)   echo "check0=$check0 -> ERROR -> could not get todo list -> exit" >> $scriptlog 2>&1
-	   rm -v $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
-	   date  >> $scriptlog 2>&1
-	   exit;;
-   esac
-   rm -v $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
+   # get todo list
+   getdolist  >> $scriptlog 2>&1
+   rm -v $lockfile >> $scriptlog 2>&1
 fi
 
@@ -135,8 +122,5 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $todofile >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
@@ -272,9 +256,4 @@
 done
 
-rm -v $todofile >> $scriptlog 2>&1
-rm -v $lockfile >> $scriptlog 2>&1
-
-set +C
-
-date  >> $scriptlog 2>&1
-
+finish >> $scriptlog 2>&1
+
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7477)
@@ -45,12 +45,8 @@
 table=DataSetProcessStatus
 column=fGanymed
-date=NULL
-datetime=`date +%F-%H-%M-%S`
-year=`date +%Y`
 #pno=24 # number of processes, i.e. number of todo-files
 
 todofile=$listpath/ToDo-$table-$column
-getstatuslogpath=$logpath/getstatus/$program/$year
-getstatuslog=$getstatuslogpath/getstatus-$program-$datetime.log
+lockfile=$lockpath/lock-getting-$program-list.txt
 
 scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
@@ -60,10 +56,8 @@
 date >> $scriptlog 2>&1
 
-makedir $getstatuslogpath >> $scriptlog 2>&1
-
 cd $mars
 
 # check if getting of list is already running
-date > $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
+date > $lockfile >> $scriptlog 2>&1
 checklock0=$?
 case $checklock0 in 
@@ -83,14 +77,8 @@
    echo " -> choose one file and run $program" >> $scriptlog 2>&1
 else
-   echo "getting list..." >> $scriptlog 2>&1
-   check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
-   
-   case $check0 in 
-       1)   echo "check0=$check0 -> everything ok -> run $program" >> $scriptlog 2>&1;;
-       *)   echo "check0=$check0 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
-   esac
+   # get todo list
+   getdolist  >> $scriptlog 2>&1
+   rm -v $lockfile >> $scriptlog 2>&1
 fi
-
-rm -v $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
 
 # choosing todo file
@@ -130,8 +118,5 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $todofile >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
@@ -178,9 +163,4 @@
 done
 
-rm -v $todofile >> $scriptlog 2>&1
-rm -v $lockfile >> $scriptlog 2>&1
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7477)
@@ -45,12 +45,8 @@
 table=SequenceProcessStatus
 column=fStar
-date=NULL
-datetime=`date +%F-%H-%M-%S`
-year=`date +%Y`
 #pno=500 # number of processes, i.e. number of todo-files
 
 todofile=$listpath/ToDo-$table-$column
-getstatuslogpath=$logpath/getstatus/$program/$year
-getstatuslog=$getstatuslogpath/getstatus-$program-$datetime.log
+lockfile=$lockpath/lock-getting-$program-list.txt
 
 scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
@@ -60,10 +56,8 @@
 date >> $scriptlog 2>&1
 
-makedir $getstatuslogpath >> $scriptlog 2>&1
-
 cd $mars
 
 # check if getting of list is already running
-date > $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
+date > $lockfile >> $scriptlog 2>&1
 checklock0=$?
 case $checklock0 in 
@@ -83,14 +77,8 @@
    echo " -> choose one file and start calculation of image parameter" >> $scriptlog 2>&1
 else
-   echo "getting list..." >> $scriptlog 2>&1
-   check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
-   
-   case $check0 in 
-       1)   echo "check0=$check0 -> everything ok -> run $program" >> $scriptlog 2>&1;;
-       *)   echo "check0=$check0 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
-   esac
+   # get todo list
+   getdolist  >> $scriptlog 2>&1
+   rm -v $lockfile >> $scriptlog 2>&1
 fi
-
-rm -v $lockpath/lock-getting-$program-list.txt >> $scriptlog 2>&1
 
 # choosing todo file
@@ -130,8 +118,5 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $todofile >> $scriptlog 2>&1
-   rm -v $lockfile >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
@@ -170,9 +155,4 @@
 done
 
-rm -v $todofile >> $scriptlog 2>&1
-rm -v $lockfile >> $scriptlog 2>&1
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7477)
@@ -63,4 +63,34 @@
 }
 
+function finish()
+{
+   rm -v $todofile
+   rm -v $lockfile
+   date 
+   exit
+}
+
+function getdolist()
+{
+   datetime=`date +%F-%H-%M-%S`
+   year=`date +%Y`
+   date=NULL
+   
+   getstatuslogpath=$logpath/getstatus/$program/$year
+   getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
+   makedir $getstatuslogpath
+
+   # get todo list
+   echo "getting todo list..."
+   check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatus | grep int | sed -e 's/(int)//'`
+
+   case $check0 in
+      1)   echo "check0=$check0 -> everything ok, got todo list -> run $program";;
+      *)   echo "check0=$check0 -> ERROR -> could not get todo list -> exit"
+           finish ;;
+   esac
+
+}
+
 function resetstatusvalues()
 {
@@ -118,5 +148,6 @@
    case $checkstatus in
       1)   echo "checkstatus=$checkstatus -> everything ok, status has been set";;
-      *)   echo "checkstatus=$checkstatus -> ERROR -> step could not be set";;
+      *)   echo "checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
+           finish ;;
    esac
 }
Index: trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7476)
+++ trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7477)
@@ -44,11 +44,7 @@
 table=SequenceProcessStatus
 column=fSequenceFileWritten
-date=NULL
-datetime=`date +%F-%H-%M-%S`
-year=`date +%Y`
 
 todofile=$listpath/ToDo-$table-$column.txt
-getstatuslogpath=$logpath/getstatus/$program/$year
-getstatuslog=$getstatuslogpath/getstatus-$program-$datetime.log
+lockfile=$lockpath/lock-$program.txt
 
 scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
@@ -58,10 +54,8 @@
 date >> $scriptlog 2>&1
 
-makedir $getstatuslogpath >> $scriptlog 2>&1
-
 cd $mars
 
 # check if script is already running
-date > $lockpath/lock-$table-$column.txt >> $scriptlog 2>&1
+date > $lockfile >> $scriptlog 2>&1
 checklock0=$?
 case $checklock0 in 
@@ -75,15 +69,5 @@
 
 # get todo list
-echo "getting list..." >> $scriptlog 2>&1
-check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
-
-case $check0 in 
-    1)   echo "check0=$check0 -> everything ok -> run $program" >> $scriptlog 2>&1;;
-    *)   echo "check0=$check0 -> ERROR -> could not get todo list -> exit" >> $scriptlog 2>&1
-         rm -v $todofile >> $scriptlog 2>&1
-         rm -v $lockpath/lock-$table-$column.txt >> $scriptlog 2>&1
-         date  >> $scriptlog 2>&1
-         exit;;
-esac
+getdolist  >> $scriptlog 2>&1
 
 # get sequences from todo file
@@ -92,8 +76,5 @@
 then 
    echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   rm -v $todofile >> $scriptlog 2>&1
-   rm -v $lockpath/lock-$table-$column.txt >> $scriptlog 2>&1
-   date  >> $scriptlog 2>&1
-   exit
+   finish >> $scriptlog 2>&1
 fi
 
@@ -110,11 +91,11 @@
 
    writesequencefilelogpath=$logpath/$program/$no
-   echo "$programlogpath: "$writesequencefilelogpath >> $scriptlog 2>&1
    makedir $writesequencefilelogpath >> $scriptlog 2>&1
+   writesequencefilelog=$writesequencefilelogpath/writesequencefile-$no2.log
 
    echo "write sequencefile for sequence $sequence" >> $scriptlog 2>&1
    setstatus "start" >> $scriptlog 2>&1
 
-   check2=`root -q -b $macrospath/writesequencefile.C+\($sequence\,"\"$sequpath\""\) | tee $writesequencefilelogpath/writesequencefile-$no2.log | grep int | sed -e 's/(int)//'`
+   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 ;;
@@ -128,9 +109,4 @@
 done
 
-rm -v $todofile >> $scriptlog 2>&1
-rm -v $lockpath/lock-$table-$column.txt >> $scriptlog 2>&1
+finish >> $scriptlog 2>&1
 
-set +C
-
-date  >> $scriptlog 2>&1
-
