Index: trunk/DataCheck/ZipRawData.sh
===================================================================
--- trunk/DataCheck/ZipRawData.sh	(revision 12609)
+++ trunk/DataCheck/ZipRawData.sh	(revision 12621)
@@ -14,9 +14,9 @@
    echo "" >> $logfile 2>&1
    rawdir=/loc_data/raw/$date
-   echo `date`": processing files in "$rawdir >> $logfile
+   echo `date`": processing files in "$rawdir >> $logfile 2>&1
    # check if data are available from that night
    if ! [ -d $rawdir ]
    then
-      echo `date`": no data available in "$rawdir >> $logfile
+      echo `date`": no data available in "$rawdir >> $logfile 2>&1
       continue
    fi
@@ -25,13 +25,19 @@
    then
       # create output directory for zip
-      mkdir -pv $zipdir >> $logfile
+      mkdir -pv $zipdir >> $logfile 2>&1
    fi
 
    # find all fits-files starting with the oldest file
-   echo `date`": finding files to be zipped in $rawdir..." >> $logfile
+   echo `date`": finding files to be zipped in $rawdir..." >> $logfile 2>&1
    fitsfiles=`find $rawdir -type f -name '*fits'| sort `
 
+   if [ ${#fitsfiles[@]} -eq 0 ]
+   then
+      echo `date`": no files to be zipped in $rawdir..." >> $logfile 2>&1
+      continue
+   fi
+
    # loop to zip files
-   echo `date`": zipping files in $rawdir..." >> $logfile
+   echo `date`": zipping files in $rawdir..." >> $logfile 2>&1
    for file in $fitsfiles
    do
@@ -49,5 +55,5 @@
       if [ "$isnew" != "" ]
       then
-         echo $file" is not older than 30 min => continue" >> $logfile
+         echo $file" is not older than 30 min => continue" >> $logfile 2>&1
          continue
       fi
@@ -65,24 +71,24 @@
          then
             # if times are not the same, the file is still open => no zip
-            echo `date`": file "$file" not yet closed => continue" >> $logfile
+            echo `date`": file "$file" not yet closed => continue" >> $logfile 2>&1
             continue
          fi
       else
          # if the origfile doesn't exist, the data was probably written not on daq but on data
-         echo `date`": file "$file" was probably taken on data and not daq " >> $logfile
+         echo `date`": file "$file" was probably taken on data and not daq " >> $logfile 2>&1
       fi
 
-      echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile
+      echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile 2>&1
       # zip file to stdout and pipe it to outputfile
       if pigz -1 -c -f $file > $zipfiletmp;
       then
          # if successful, move temporary to final zipfile
-         mv -v $zipfiletmp $zipfile >> $logfile
+         mv -v $zipfiletmp $zipfile >> $logfile 2>&1
       else
          # if not successful, remove temporary zipfile
-         rm -v $zipfiletmp >> $logfile
+         rm -v $zipfiletmp >> $logfile 2>&1
       fi
    done
 done
+echo "finished zipping..." >> $logfile 2>&1
 
-
