Changeset 18872 for trunk


Ignore:
Timestamp:
05/21/17 10:34:57 (7 years ago)
Author:
Daniela Dorner
Message:
implemented option to use /data1 instead of /scratch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Transfer/ZipRawData.sh

    r18853 r18872  
    11#!/bin/bash
    22
    3 # this script has been written to run on La Palma on the machine data
     3# this script has been written to run on La Palma on the machine newdata
    44#   i.e. paths are only working on this machine
    55
     6# to use script with /data1 instead of /scratch
     7#  (e.g. when /scratch is full)
     8# export data1=yes
     9# before executing the script
    610source `dirname $0`/../Sourcefile.sh
    711printprocesslog "INFO starting "$0
     
    2731fi
    2832
     33rsynctempdir=/data1/rsync_tmp
     34if ! [ -d $rsynctempdir ]
     35then
     36   mkdir $rsynctempdir
     37fi
     38
    2939# not needed anymore as ftools are not used anymore
    3040## setup to use ftools
     
    3848do
    3949   echo "" >> $logfile 2>&1
    40    rawdir=/scratch/raw/$date
     50   if [ "$data1" = "yes" ]
     51   then
     52      rawdir=/data1/raw/$date
     53      printprocesslog "INFO using "$rawdir" as input"
     54   else
     55      rawdir=/scratch/raw/$date
     56   fi
    4157   echo `date`": processing files in "$rawdir >> $logfile 2>&1
    4258   printprocesslog "INFO processing files in "$rawdir
     
    98114      fi
    99115     
     116      printprocesslog "INFO process file "$file
     117      if [ "$certaindate" != "" ]
     118      then
     119         echo "INFO process file "$file
     120      fi
    100121      # first rsync from /scratch to /data1
    101       file2=`echo $file | sed -e 's/scratch/data1/'`
    102       if ! rsync -au -T $rsynctempdir $file $file2
    103       then
    104          printprocesslog "ERROR something went wrong with rsync of "$file
    105          rm $file2
    106          continue
    107       fi
    108      
     122      if [ "$data1" != "yes" ]
     123      then
     124         file2=`echo $file | sed -e 's/scratch/data1/'`
     125         if ! rsync -au -T $rsynctempdir $file $file2
     126         then
     127            printprocesslog "ERROR something went wrong with rsync of "$file
     128            rm $file2
     129            continue
     130         fi
     131      fi
     132      # copying to /data2
    109133      iszipped=`echo $file | grep -o fz`
    110134      if [ "$iszipped" == "fz" ]
     
    114138
    115139         # filename for file on data
    116          zipfile=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' `
    117          zipfiletmp=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' -e 's/fits.fz/fits.fz.tmp/'`
    118          
     140         if [ "$data1" = "yes" ]
     141         then
     142            zipfile=`echo $file | sed -e 's/data1/data2/g' -e 's/raw/zipraw/' `
     143            zipfiletmp=`echo $file | sed -e 's/data1/data2/g' -e 's/raw/zipraw/' -e 's/fits.fz/fits.fz.tmp/'`
     144         else
     145            zipfile=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' `
     146            zipfiletmp=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' -e 's/fits.fz/fits.fz.tmp/'`
     147         fi
    119148         # check if file on data already exists
    120149         if [ -e $zipfile ]
     
    152181
    153182         # filename for temporary and final zipfile
    154          zipfile=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' -e 's/fits/fits.gz/'`
    155          zipfiletmp=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' -e 's/fits/fits.tmp.gz/'`
     183         if [ "$data1" = "yes" ]
     184         then
     185            zipfile=`echo $file | sed -e 's/data1/data2/g' -e 's/raw/zipraw/' -e 's/fits/fits.gz/'`
     186            zipfiletmp=`echo $file | sed -e 's/data1/data2/g' -e 's/raw/zipraw/' -e 's/fits/fits.tmp.gz/'`
     187         else
     188            zipfile=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' -e 's/fits/fits.gz/'`
     189            zipfiletmp=`echo $file | sed -e 's/scratch/data2/g' -e 's/raw/zipraw/' -e 's/fits/fits.tmp.gz/'`
     190         fi
    156191         
    157192         # check if zipped file already exists
Note: See TracChangeset for help on using the changeset viewer.