Index: trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 7233)
@@ -45,28 +45,10 @@
 
 scriptlogpath=$logpath/run/buildsequenceentries/`date +%Y/%m`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
-
+makedir $scriptlogpath
 scriptlog=$scriptlogpath/buildsequenceentries-$datetime.log
 
 date >> $scriptlog 2>&1
 
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 date > $lockpath/lock-buildsequenceentries.txt >> $scriptlog 2>&1 
@@ -108,13 +90,6 @@
    year2=`echo $date | cut -c 1-4`
    buildsequentriespath=$logpath/buildsequenceentries/$year2
-   if [ ! -d $buildsequentriespath ]
-      then
-      mkdir -pv $buildsequentriespath >> $scriptlog 2>&1
-      if [ ! -d $buildsequentriespath ]
-      then 
-         echo "could not make buildsequentriespath "$buildsequentriespath >> $scriptlog 2>&1
-         continue
-      fi
-   fi
+   makedir  $buildsequentriespath >> $scriptlog 2>&1
+
    check1=`root -q -b $macrospath/buildsequenceentries.C+\("\"$date\""\,"\"$datapath\""\,"\"$sequpath\""\,kFALSE\) | tee $buildsequentriespath/buildsequenceentries-$date.log | grep int | sed -e 's/(int)//'`
 
@@ -122,13 +97,6 @@
       1)   echo "check1=$check1 -> everthing ok -> setting status..." >> $scriptlog 2>&1
            setstatuslogpath=$logpath/setstatus/buildsequenceentries/$year2
-           if [ ! -d $setstatuslogpath ]
-           then
-             mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-             if [ ! -d $setstatuslogpath ]
-             then
-                echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-                continue
-             fi
-           fi
+           makedir $setstatuslogpath >> $scriptlog 2>&1
+
            check2=`root -q -b $macrospath/setstatus.C+\("\"$date\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\)  | tee $setstatuslogpath/setstatus-buildsequenceentries-$date.log | grep int | sed -e 's/(int)//'`
            case $check2 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 7233)
@@ -41,13 +41,5 @@
 
 scriptlogpath=$logpath/run/checkfilesavail/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/checkfilesforsequenceavail-$datetime.log
@@ -55,13 +47,5 @@
 date >> $scriptlog 2>&1
 
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath  >> $scriptlog 2>&1 
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -100,13 +84,6 @@
    outpath=$logpath/checkfileavail/$no
    echo "outpath: "$outpath  >> $scriptlog 2>&1 
-   if [ ! -d $outpath ]
-   then
-     mkdir -pv $outpath  >> $scriptlog 2>&1 
-     if [ ! -d $outpath ]
-     then 
-        echo "could not make outpath $outpath -> continue "  >> $scriptlog 2>&1 
-        continue
-     fi
-   fi
+   makedir $outpath  >> $scriptlog 2>&1 
+
    check1=`root -q -b $macrospath/checkfileavail.C+\(\""$sequence\""\) | tee $outpath/checkfileavail-$sequence.log | grep int | sed -e 's/(int)//'`
 
@@ -114,13 +91,6 @@
       1)   echo "check1=$check1 -> everthing ok -> setting status..." >> $scriptlog 2>&1 
            setstatuslogpath=$logpath/setstatus/checkfileavail/$no
-           if [ ! -d $setstatuslogpath ]
-           then
-             mkdir -pv $setstatuslogpath  >> $scriptlog 2>&1 
-             if [ ! -d $setstatuslogpath ]
-             then
-                echo "could not make setstatuslogpath "$setstatuslogpath  >> $scriptlog 2>&1 
-                continue
-             fi
-           fi
+           makedir $setstatuslogpath  >> $scriptlog 2>&1 
+
            check2=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\)  | tee $setstatuslogpath/setstatus-checkfileavail-$sequence.log | grep int | sed -e 's/(int)//'`
     	   case $check2 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkstardone
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 7233)
@@ -41,13 +41,5 @@
 
 scriptlogpath=$logpath/run/checkstardone/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/checkstardone-$datetime.log
@@ -55,13 +47,5 @@
 date >> $scriptlog 2>&1
 
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath  >> $scriptlog 2>&1 
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -113,13 +97,5 @@
    outpath=$logpath/checkstardone/$no
    echo "outpath: "$outpath  >> $scriptlog 2>&1 
-   if [ ! -d $outpath ]
-   then
-     mkdir -pv $outpath  >> $scriptlog 2>&1 
-     if [ ! -d $outpath ]
-     then 
-        echo "could not make outpath $outpath -> continue "  >> $scriptlog 2>&1 
-        continue
-     fi
-   fi
+   makedir $outpath  >> $scriptlog 2>&1 
    
    for sequence in ${sequences[@]}
@@ -137,13 +113,6 @@
    
    setstatuslogpath=$logpath/setstatus/checkstardone/$no
-   if [ ! -d $setstatuslogpath ]
-   then
-     mkdir -pv $setstatuslogpath  >> $scriptlog 2>&1
-     if [ ! -d $setstatuslogpath ]
-     then
-        echo "could not make setstatuslogpath "$setstatuslogpath  >> $scriptlog 2>&1
-        continue
-     fi
-   fi
+   makedir $setstatuslogpath  >> $scriptlog 2>&1 
+
    check2=`root -q -b $macrospath/setstatus.C+\("\"$dataset\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\)  | tee $setstatuslogpath/setstatus-checkstardone-$dataset.log | grep int | sed -e 's/(int)//'`
    case $check2 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/copyscript
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7233)
@@ -70,13 +70,5 @@
 
 scriptlogpath=$logpath/run/copyscript/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/copyscript-$datetime.log
@@ -149,13 +141,5 @@
    copylogpath=$logpath/copyscript/$date2
    echo "copylogpath: "$copylogpath >> $scriptlog 2>&1
-   if [ ! -d $copylogpath ]
-   then
-     mkdir -pv $copylogpath >> $scriptlog 2>&1
-     if [ ! -d $copylogpath ]
-     then
-        echo "could not make copylogpath $copylogpath -> continue " >> $scriptlog 2>&1
-        continue
-     fi
-   fi
+   makedir $copylogpath >> $scriptlog 2>&1
    
    #loop over all files in the directories for this date
@@ -172,15 +156,6 @@
          echo "file (new path): "$newfile >> $scriptlog 2>&1 
          newpath=`dirname $newfile`
-#         echo "new path: "$newpath
          #make sure, that the needed directories are available
-         if [ ! -d $newpath ]
-         then
-            mkdir -pv $newpath >> $scriptlog 2>&1 
-            if [ ! -d $newpath ]
-            then 
-               echo "could not make path $newpath"  >> $scriptlog 2>&1 
-               continue
-            fi
-         fi
+         makedir $newpath >> $scriptlog 2>&1 
          
          #run macros if the file is a *.rbk or a *.run file to
Index: trunk/MagicSoft/Mars/datacenter/scripts/correcttime
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/correcttime	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/correcttime	(revision 7233)
@@ -38,15 +38,5 @@
 getstatuslogpath=$logpath/getstatus/correct_raw_time/$year
 getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath 
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath 
-     exit
-  fi
-fi
-
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 if [ -e $listpath/ToDo-$table-$column.txt ]
@@ -86,24 +76,9 @@
   outpath=`dirname $outfile`
   echo "outpath:"$outpath
-  if [ ! -d $outpath ]
-  then
-    mkdir -pv $outpath
-    if [ ! -d $outpath ]
-    then 
-       echo "could not make outpath "$outpath
-       continue
-    fi
-  fi
+  makedir $outpath
+
   timecorrpath=$outpath"/timecorrlogs"
   echo "timecorrpath: "$timecorrpath
-  if [ ! -d $timecorrpath ]
-  then
-    mkdir -pv $timecorrpath
-    if [ ! -d $timecorrpath ]
-    then
-       echo "could not make timecorrpath "$timecorrpath
-       continue
-    fi
-  fi
+  make dir $timecorrpath 
   
   check1=0
@@ -117,13 +92,6 @@
           setstatuspath=$logpath/setstatus/correct_raw_time/$no
           echo "setstatuspath: "$setstatuspath 
-          if [ ! -d $setstatuspath ]
-          then
-            mkdir -pv $setstatuspath 
-            if [ ! -d $setstatuspath ]
-            then
-               echo "could not make setstatuspath $setstatuspath -> continue " 
-               continue
-            fi
-          fi
+          makedir $setstatuspath
+
           check2=`root -q -b $macrospath/setstatus.C+\("\"$run\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuspath/setstatus-correct_raw_time-$run.log | grep int | sed -e 's/(int)//'`
           case $check2 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/doexclusions
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 7233)
@@ -45,13 +45,5 @@
 
 scriptlogpath=$logpath/run/doexclusions/`date +%Y/%m`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/doexclusions-$datetime.log
@@ -59,14 +51,5 @@
 date >> $scriptlog 2>&1
 
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 date > $lockpath/lock-doexclusions.txt >> $scriptlog 2>&1 
@@ -108,13 +91,6 @@
    year2=`echo $date | cut -c 1-4`
    doexclusionspath=$logpath/doexclusions/$year2
-   if [ ! -d $doexclusionspath ]
-      then
-      mkdir -pv $doexclusionspath >> $scriptlog 2>&1
-      if [ ! -d $doexclusionspath ]
-      then 
-         echo "could not make doexclusionspath "$doexclusionspath >> $scriptlog 2>&1
-         continue
-      fi
-   fi
+   makedir $doexclusionspath >> $scriptlog 2>&1
+
    check1=`root -q -b $macrospath/doexclusions.C+\("\"$date\""\) | tee $doexclusionspath/doexclusions-$date.log | grep int | sed -e 's/(int)//'`
 
@@ -122,14 +98,8 @@
       1)   echo "check1=1 -> everthing ok -> setting status..."
            setstatuslogpath=$logpath/setstatus/doexclusions/$year2
-           if [ ! -d $setstatuslogpath ]
-           then
-             mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-             if [ ! -d $setstatuslogpath ]
-             then
-                echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-                continue
-             fi
-           fi
+           makedir $setstatuslogpath >> $scriptlog 2>&1
+
            check2=`root -q -b $macrospath/setstatus.C+\("\"$date\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\)  | tee $setstatuslogpath/setstatus-doexclusions-$date.log | grep int | sed -e 's/(int)//'`
+
      	   case $check2 in
    	      1)   echo "check2=$check2 -> everthing ok, status has been set";;
Index: trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 7233)
@@ -35,15 +35,5 @@
 subsystemdir=/magic/subsystemdata
 filesondisklogpath=$logpath/filesondisk/`date +%Y`
-
-if [ ! -d $filesondisklogpath ]
-then
-  mkdir -pv $filesondisklogpath 
-  if [ ! -d $filesondisklogpath ]
-  then 
-     echo "could not make directory "$filesondisklogpath 
-     exit
-  fi
-fi
-
+makedir $filesondisklogpath 
 
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 7233)
@@ -43,13 +43,5 @@
 
 scriptlogpath=$logpath/run/fillcallisto/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/runfillcallisto-$datetime.log
@@ -57,15 +49,5 @@
 date >> $scriptlog 2>&1
 
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -112,13 +94,5 @@
    fillcallistologpath=$logpath/fillcallisto/$no
    echo "fillcallistologpath: "$fillcallistologpath >> $scriptlog 2>&1
-   if [ ! -d $fillcallistologpath ]
-   then
-     mkdir -pv $fillcallistologpath >> $scriptlog 2>&1
-     if [ ! -d $fillcallistologpath ]
-     then
-        echo "could not make fillcallistologpath $fillcallistologpath -> continue " >> $scriptlog 2>&1
-        continue
-     fi
-   fi
+   makedir $fillcallistologpath >> $scriptlog 2>&1
    fillcaliblog=$fillcallistologpath/fillcalib-$sequence.log
    fillsignallog=$fillcallistologpath/fillsignal-$sequence.log
@@ -139,14 +113,7 @@
            echo "-> inserting the status for fillcallisto for sequence $sequence into the db" >> $scriptlog 2>&1
            setstatuslogpath=$logpath/setstatus/fillcallisto/$no
-           if [ ! -d $setstatuslogpath ]
-           then
-             mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-             if [ ! -d $setstatuslogpath ]
-             then
-                echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-                continue
-             fi
-           fi
+           makedir $setstatuslogpath >> $scriptlog 2>&1
            setstatuslog=$setstatuslogpath/setstatus-fillcallisto
+
            check4=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslog-$sequence.log | grep int | sed -e 's/(int)//'`
            case $check4 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 7233)
@@ -43,29 +43,10 @@
 
 scriptlogpath=$logpath/run/fillstar/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
-
+makedir $scriptlogpath
 scriptlog=$scriptlogpath/runfillstar-$datetime.log
 
 date >> $scriptlog 2>&1
 
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -111,13 +92,5 @@
    fillstarlogpath=$logpath/fillstar/$no
    echo "fillstarlogpath: "$fillstarlogpath >> $scriptlog 2>&1
-   if [ ! -d $fillstarlogpath ]
-   then
-     mkdir -pv $fillstarlogpath >> $scriptlog 2>&1
-     if [ ! -d $fillstarlogpath ]
-     then
-        echo "could not make fillstarlogpath $fillstarlogpath -> continue " >> $scriptlog 2>&1
-        continue
-     fi
-   fi
+   makedir $fillstarlogpath >> $scriptlog 2>&1
    fillstarlog=$fillstarlogpath/fillstar-$sequence.log
 
@@ -128,14 +101,7 @@
            echo "-> inserting the status for fillstar for sequence $sequence into the db" >> $scriptlog 2>&1
            setstatuslogpath=$logpath/setstatus/fillstar/$no
-           if [ ! -d $setstatuslogpath ]
-           then
-             mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-             if [ ! -d $setstatuslogpath ]
-             then
-                echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-                continue
-             fi
-           fi
+           makedir $setstatuslogpath >> $scriptlog 2>&1
            setstatuslog=$setstatuslogpath/setstatus-fillstar-$no2.log
+
            check4=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
            case $check4 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7233)
@@ -38,13 +38,5 @@
 
 scriptlogpath=$logpath/run/insertdatasets/`date +%Y/%m`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/insertdatasets-$datetime.log
@@ -97,14 +89,7 @@
    
    insertdatasetpath=$logpath/insertdataset/$no3
-   if [ ! -d $insertdatasetpath ]
-      then
-      mkdir -pv $insertdatasetpath >> $scriptlog 2>&1
-      if [ ! -d $insertdatasetpath ]
-      then 
-         echo "could not make insertdatasetpath "$insertdatasetpath >> $scriptlog 2>&1
-         continue
-      fi
-   fi
+   makedir $insertdatasetpath >> $scriptlog 2>&1
    insertdatasetlog=$insertdatasetpath/insertdataset-$no3.log
+
    check0=`root -q -b $macrospath/insertdataset.C+\("\"$no2\""\,"\"$source\""\,"\"$wobble\"",kFALSE\) | tee $insertdatasetlog | grep int | sed -e 's/(int)//'`
    case $check0 in 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7233)
@@ -46,29 +46,10 @@
 
 scriptlogpath=$logpath/run/callisto/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
-
+makedir $scriptlogpath
 scriptlog=$scriptlogpath/runcallisto-$datetime.log
 
 date >> $scriptlog 2>&1
 
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -178,13 +159,6 @@
   outpath="$datapath/callisto/$no/$no2"
   echo "outpath: "$outpath >> $scriptlog 2>&1
-  if [ ! -d $outpath ]
-  then
-    mkdir -pv $outpath >> $scriptlog 2>&1
-    if [ ! -d $outpath ]
-    then 
-       echo "could not make outpath $outpath -> continue " >> $scriptlog 2>&1
-       continue
-    fi
-  fi
+  makedir $outpath >> $scriptlog 2>&1
+
   sequfile="$sequpath/$no/sequence$no2.txt"
   echo "sequfile: "$sequfile >> $scriptlog 2>&1
@@ -216,13 +190,5 @@
           
           merpplogpath=$outpath"/merpplogs"
-          if [ ! -d $merpplogpath ]
-          then
-            mkdir -pv $merpplogpath >> $scriptlog 2>&1
-            if [ ! -d $merpplogpath ]
-            then
-               echo "could not make merpplogpath "$merpplogpath >> $scriptlog 2>&1
-               continue
-            fi
-          fi
+          makedir $merpplogpath >> $scriptlog 2>&1
           
           for calfile in ${calfiles[@]}
@@ -279,14 +245,7 @@
           echo "inserting the status for callisto for sequence $sequence into the db" >> $scriptlog 2>&1
           setstatuslogpath=$logpath/setstatus/callisto/$no
-          if [ ! -d $setstatuslogpath ]
-          then
-            mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-            if [ ! -d $setstatuslogpath ]
-            then 
-               echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-               continue
-            fi
-          fi
+          makedir $setstatuslogpath >> $scriptlog 2>&1
           setstatuslog=$setstatuslogpath/setstatus-callisto-$no2.log
+
           check4=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
           case $check4 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7233)
@@ -44,13 +44,5 @@
 
 scriptlogpath=$logpath/run/ganymed/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
+makedir $scriptlogpath
 
 scriptlog=$scriptlogpath/runganymed-$datetime.log
@@ -58,15 +50,5 @@
 date >> $scriptlog 2>&1
 
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -172,13 +154,6 @@
   outpath="$datapath/ganymed/$no/$no2"
   echo "outpath: "$outpath >> $scriptlog 2>&1
-  if [ ! -d $outpath ]
-  then
-    mkdir -pv $outpath >> $scriptlog 2>&1
-    if [ ! -d $outpath ]
-    then 
-       echo "could not make outpath $outpath -> continue " >> $scriptlog 2>&1
-       continue
-    fi
-  fi
+  makedir $outpath >> $scriptlog 2>&1
+
   datasetfile="$datasetpath/$no/dataset$no2.txt"
   echo "datasetfile: "$datasetfile >> $scriptlog 2>&1
@@ -201,14 +176,7 @@
           echo "-> inserting the status for ganymed for dataset $dataset into the db" >> $scriptlog 2>&1
           setstatuslogpath=$logpath/setstatus/ganymed/$no
-          if [ ! -d $setstatuslogpath ]
-          then
-             mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-             if [ ! -d $setstatuslogpath ]
-             then 
-                echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-                continue
-             fi
-          fi
+          makedir $setstatuslogpath >> $scriptlog 2>&1
           setstatuslog=$setstatuslogpath/setstatus-ganymed-$no2.log
+
           check4=`root -q -b $macrospath/setstatus.C+\("\"$dataset\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
           case $check4 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7233)
@@ -44,29 +44,10 @@
 
 scriptlogpath=$logpath/run/star/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
-
+makedir $scriptlogpath
 scriptlog=$scriptlogpath/runstar-$datetime.log
 
 date >> $scriptlog 2>&1
 
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -175,13 +156,6 @@
   echo "inpath: "$inpath >> $scriptlog 2>&1
   echo "outpath: "$outpath >> $scriptlog 2>&1
-  if [ ! -d $outpath ]
-  then
-    mkdir -pv $outpath >> $scriptlog 2>&1
-    if [ ! -d $outpath ]
-    then 
-       echo "could not make outpath $outpath -> continue " >> $scriptlog 2>&1
-       continue
-    fi
-  fi
+  makedir $outpath >> $scriptlog 2>&1
+
   sequfile="$sequpath/$no/sequence$no2.txt"
   echo "sequfile: "$sequfile >> $scriptlog 2>&1
@@ -195,14 +169,7 @@
           echo "-> inserting the status for star for sequence $sequence into the db" >> $scriptlog 2>&1
           setstatuslogpath=$logpath/setstatus/star/$no
-          if [ ! -d $setstatuslogpath ]
-          then
-            mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-            if [ ! -d $setstatuslogpath ]
-            then 
-               echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-               continue
-            fi
-          fi
+          makedir $setstatuslogpath >> $scriptlog 2>&1
           setstatuslog=$setstatuslogpath/setstatus-star-$no2.log
+
           check4=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
           case $check4 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7233)
@@ -45,2 +45,15 @@
 datasetpath=/magic/datasets
 
+
+function makedir()
+{
+   if [ ! -d $@ ]
+   then
+     mkdir -pv $@ 
+     if [ ! -d $@ ]
+     then 
+        echo "could not make dir "$@
+        exit
+     fi
+   fi
+}
Index: trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7232)
+++ trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 7233)
@@ -43,29 +43,10 @@
 
 scriptlogpath=$logpath/run/writesequencefiles/`date +%Y/%m/%d`
-if [ ! -d $scriptlogpath ]
-then
-  mkdir -pv $scriptlogpath 
-  if [ ! -d $scriptlogpath ]
-  then 
-     echo "could not make scriptlogpath "$scriptlogpath 
-     exit
-  fi
-fi
-
+makedir $scriptlogpath
 scriptlog=$scriptlogpath/runwritesequencefiles-$datetime.log
 
 date >> $scriptlog 2>&1
 
-
-if [ ! -d $getstatuslogpath ]
-then
-  mkdir -pv $getstatuslogpath >> $scriptlog 2>&1
-  if [ ! -d $getstatuslogpath ]
-  then 
-     echo "could not make getstatuslogpath "$getstatuslogpath >> $scriptlog 2>&1
-     date  >> $scriptlog 2>&1
-     exit
-  fi
-fi
+makedir $getstatuslogpath >> $scriptlog 2>&1
 
 cd $mars
@@ -108,25 +89,9 @@
    no2=`printf %08d $sequence`
    sequencepath=$sequpath/$no
-   if [ ! -d $sequencepath ]
-   then
-     mkdir -pv $sequencepath >> $scriptlog 2>&1
-     if [ ! -d $sequencepath ]
-     then
-        echo "could not make sequencepath $sequencepath -> continue " >> $scriptlog 2>&1
-        continue
-     fi
-   fi
+   makedir $sequencepath >> $scriptlog 2>&1
 
    writesequencefilelogpath=$logpath/writesequencefile/$no
    echo "writesequencefilelogpath: "$writesequencefilelogpath >> $scriptlog 2>&1
-   if [ ! -d $writesequencefilelogpath ]
-   then
-     mkdir -pv $writesequencefilelogpath >> $scriptlog 2>&1
-     if [ ! -d $writesequencefilelogpath ]
-     then
-        echo "could not make writesequencefilelogpath $writesequencefilelogpath -> continue " >> $scriptlog 2>&1
-        continue
-     fi
-   fi
+   makedir $writesequencefilelogpath >> $scriptlog 2>&1
 
    echo "write sequencefile for sequence $sequence" >> $scriptlog 2>&1
@@ -136,14 +101,7 @@
            echo "-> inserting the status for writesequencefile for sequence $sequence into the db" >> $scriptlog 2>&1
            setstatuslogpath=$logpath/setstatus/writesequencefile/$no
-           if [ ! -d $setstatuslogpath ]
-           then
-             mkdir -pv $setstatuslogpath >> $scriptlog 2>&1
-             if [ ! -d $setstatuslogpath ]
-             then
-                echo "could not make setstatuslogpath "$setstatuslogpath >> $scriptlog 2>&1
-                continue
-             fi
-           fi
+           makedir $setstatuslogpath >> $scriptlog 2>&1
            setstatuslog=$setstatuslogpath/setstatus-writesequencefile-$no2.log
+
            check4=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
            case $check4 in
