Index: /trunk/DataCheck/ZipRawData.sh
===================================================================
--- /trunk/DataCheck/ZipRawData.sh	(revision 12969)
+++ /trunk/DataCheck/ZipRawData.sh	(revision 12970)
@@ -1,6 +1,12 @@
 #!/bin/bash
 
-today=`date +%F`
-logfile=/home/`whoami`/DataCheck/log/ZipRaw$today.log
+# this script has been written to run on La Palma on the machine data
+#   i.e. paths are only working on this machine
+
+source `dirname $0`/Sourcefile.sh
+printprocesslog "INFO starting "$0
+
+logfile=$runlogpath"/ZipRawLP-"$datetime".log"
+date >> $logfile
 
 # get last 3 nights
@@ -11,5 +17,4 @@
 
 # setup to use ftools
-export HEADAS=/opt/heasoft-6.11/x86_64-unknown-linux-gnu-libc2.13-0/
 source $HEADAS/headas-init.sh
 
@@ -18,12 +23,12 @@
 do 
    echo "" >> $logfile 2>&1
-   echo "" >> $logfile 2>&1
-   echo "" >> $logfile 2>&1
    rawdir=/loc_data/raw/$date
    echo `date`": processing files in "$rawdir >> $logfile 2>&1
+   printprocesslog "INFO processing files in "$rawdir
    # check if data are available from that night
    if ! [ -d $rawdir ]
    then
       echo `date`": no data available in "$rawdir >> $logfile 2>&1
+      printprocesslog "INFO no data available in "$rawdir
       continue
    fi
@@ -32,9 +37,10 @@
    then
       # create output directory for zip
-      mkdir -pv $zipdir >> $logfile 2>&1
+      makedir $zipdir >> $logfile 2>&1
    fi
 
    # find all fits-files starting with the oldest file
    echo `date`": finding files to be zipped in $rawdir..." >> $logfile 2>&1
+   printprocesslog "INFO finding files to be zipped in "$rawdir"..."
    fitsfiles=`find $rawdir -type f -name '*fits'| sort `
 
@@ -42,4 +48,5 @@
    then
       echo `date`": no files to be zipped in $rawdir..." >> $logfile 2>&1
+      printprocesslog "INFO no files to be zipped in "$rawdir"..."
       continue
    fi
@@ -47,4 +54,5 @@
    # loop to zip files
    echo `date`": zipping files in $rawdir..." >> $logfile 2>&1
+   printprocesslog "INFO zipping files in "$rawdir"..."
    for file in $fitsfiles
    do
@@ -63,4 +71,5 @@
       then
          echo $file" is not older than $delaytime min => continue" >> $logfile 2>&1
+         printprocesslog "INFO "$file" is not older than $delaytime min => continue"
          continue
       fi
@@ -79,4 +88,5 @@
             # if times are not the same, the file is still open => no zip
             echo `date`": file "$file" not yet closed => continue" >> $logfile 2>&1
+            printprocesslog "WARN file "$file" not yet closed => continue"
             continue
          fi
@@ -84,4 +94,5 @@
          # 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 2>&1
+         printprocesslog "WARN file "$file" was probably taken on data and not daq "
       fi
 
@@ -99,11 +110,14 @@
 
       echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile 2>&1
+      printprocesslog "INFO zipping "$file" to "$zipfile" ..."
       # zip file to stdout and pipe it to outputfile
-      if pigz -1 -c -f $file > $zipfiletmp;
+      if pigz -1 -c -f $file > $zipfiletmp
       then
          # if successful, move temporary to final zipfile
+         printprocesslog "INFO move "$zipfiletmp" to "$zipfile" ..."
          mv -v $zipfiletmp $zipfile >> $logfile 2>&1
       else
          # if not successful, remove temporary zipfile
+         printprocesslog "INFO remove "$zipfiletmp"..."
          rm -v $zipfiletmp >> $logfile 2>&1
       fi
@@ -111,3 +125,3 @@
 done
 echo "finished zipping..." >> $logfile 2>&1
-
+finish
