Index: trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles	(revision 9090)
+++ trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles	(revision 9091)
@@ -51,15 +51,6 @@
 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
 
-printprocesslog "INFO moving directories from muxdata to rawdata"
-# find directories which have to be copied
-days=`find /magic/datacenter/fromtape/muxdata/* -type d`
-if [ ! "$days" == "" ]
-then
-   # move directories to the tapedirectory
-   mv -v $days /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1
-fi
-
-# find rawfiles
-rawfiles=`find /magic/{datacenter,data/rawfiles}/fromtape/*data/ -regextype posix-egrep -regex '.*/20[01][0-9]{5}_(M[12]_)?[0-9]{8}(\.[0-9]{3})?_.*.raw' -type f`
+# find rawfiles belonging to tape (don't move files not yet md5-sum checked)
+rawfiles=`find /magic/{datacenter,data/rawfiles}/fromtape/???data/ -regextype posix-egrep -regex '.*/20[01][0-9]{5}_(M[12]_)?[0-9]{8}(\.[0-9]{3})?_.*.raw' -type f -user tape`
 
 if [ "$rawfiles" == "" ]
@@ -69,4 +60,5 @@
 fi
 
+# move rawfiles
 printprocesslog "INFO moving rawfiles to $datapath/rawfiles"
 for rawfile in $rawfiles
@@ -77,5 +69,6 @@
    if [ "$path" == "datacenter" ]
    then
-      newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
+      subpath=`dirname $rawfile | cut -d/ -f5`
+      newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/'${subpath}'/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
    elif [ "$path" == "data" ]
    then
@@ -93,5 +86,5 @@
 done
 
-rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/*data/* >> $scriptlog 2>&1
+rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/???data/* >> $scriptlog 2>&1
 
 printprocesslog "INFO launching filesondisk"
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 9090)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 9091)
@@ -95,5 +95,5 @@
 
 # lock sequ for zipping
-lockfile=$lockpath/calzip$sequence.txt
+lockfile=$lockpath/calzip${sequence}-${telnum}.txt
 # if lockfile is already existing, 1 is returned
 if ! checklock return 1 >> $scriptlog 2>&1
Index: trunk/MagicSoft/Mars/datacenter/scripts/zipscript
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/zipscript	(revision 9090)
+++ trunk/MagicSoft/Mars/datacenter/scripts/zipscript	(revision 9091)
@@ -32,5 +32,5 @@
 # to give the possibility to run several zipscripts at the same time, 
 # $1 is added
-program=zipscript$1
+program=zipscript2
 
 set -C
@@ -57,19 +57,31 @@
    echo "processing file $file..." >> $scriptlog 2>&1 
    runno=`basename $file | sed -e 's/.*20[01][0-9]\{5\}_\(M[12]_\)\?.*\([0-9]\{8\}\).\([0-9]\{3\}\)\?.*/\2/'`
-   query="SELECT fSequenceFirst FROM RunData WHERE fRunNumber="$runno
+   fileno=`basename $file | sed -e 's/.*20[01][0-9]\{5\}_\(M[12]_\)\?.*\([0-9]\{8\}\).\([0-9]\{3\}\)\?.*/\3/'`
+   telno=`basename $file | sed -e 's/.*20[01][0-9]\{5\}_\(M[12]_\)\?.*\([0-9]\{8\}\).\([0-9]\{3\}\)\?.*/\1/' | cut -c2`
+   # old runs have a fileno of 0
+   if [ "$fileno" == "" ]
+   then
+      fileno=0
+   fi
+   # old runs have a telno of 1
+   if [ "$telno" == "" ]
+   then
+      telno=1
+   fi
+   query="SELECT fSequenceFirst FROM RunData WHERE fRunNumber="$runno" AND fFileNumber="$fileno" AND fTelescopeNumber="$telno
    echo " sending query: $query" >> $scriptlog 2>&1 
    if ! seq=`sendquery`
    then
-      echo "querying seq for run $runno from the db did not work -> continue" >> $scriptlog 2>&1
-      printprocesslog "WARN query $seq for run $runno from the db did not work"
+      echo "querying seq for run M_${telno}${runno}.${fileno} from the db did not work -> continue" >> $scriptlog 2>&1
+      printprocesslog "WARN query $seq for run M_${telno}${runno}.${fileno} from the db did not work"
       continue
    fi
    if [ "$seq" == "" ] 
    then
-      echo "no seq found for run $runno -> locking only run..." >> $scriptlog 2>&1
+      echo "no seq found for run M_${telno}${runno}.${fileno} -> locking only run..." >> $scriptlog 2>&1
       seq=$runno
    fi
    echo "locking sequence $seq..."  >> $scriptlog 2>&1 
-   lockfile=$lockpath/calzip$seq.txt
+   lockfile=$lockpath/calzip${seq}-${telno}.txt
    checklock continue >> $scriptlog 2>&1
    query="UPDATE SequenceProcessStatus set fNotZipping=NULL WHERE fSequenceFirst=$seq"
