Changeset 12575 for trunk/DataCheck/ZipRawData.sh
- Timestamp:
- 11/20/11 07:11:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/ZipRawData.sh
r12547 r12575 7 7 logfile=/home/`whoami`/DataCheck/log/ZipRaw$today.log 8 8 9 echo "" >> $logfile 2>&1 10 echo "" >> $logfile 2>&1 11 echo "" >> $logfile 2>&1 9 12 rawdir=/loc_data/raw/$year/$month 10 13 echo `date`": processing files in "$rawdir >> $logfile … … 26 29 done 27 30 31 # find all fits-files starting with the oldest file 28 32 echo `date`": finding files to be zipped in $rawdir..." >> $logfile 29 fitsfiles=`find $rawdir -type f -name '*fits' | sort -r`33 fitsfiles=`find $rawdir -type f -name '*fits'| sort ` 30 34 35 # loop to zip files 31 36 echo `date`": zipping files in $rawdir..." >> $logfile 32 37 for file in $fitsfiles 33 38 do 39 # filename for temporary and final zipfile 34 40 zipfile=`echo $file | sed -e 's/raw/zipraw/' -e 's/fits/fits.gz/'` 35 41 zipfiletmp=`echo $file | sed -e 's/raw/zipraw/' -e 's/fits/fits.tmp.gz/'` … … 39 45 continue 40 46 fi 47 48 # check if files was accessed in the last 30 minutes 49 isnew=`find $file -amin -30` 50 if [ "$isnew" != "" ] 51 then 52 echo $file" is not older than 30 min => continue" >> $logfile 53 continue 54 fi 55 56 # check if file is already finished 57 # original file on daq (if data was taken on daq 58 origfile=`echo $file | sed -e 's/loc_data/daq/'` 59 if [ -e $origfile ] 60 then 61 # get time of last modification as seconds since Epoch for both files 62 timeorig=`stat -c %Y $origfile` 63 timecopy=`stat -c %Y $file` 64 # compare times 65 if ! [ $timeorig -eq $timecopy ] 66 then 67 # if times are not the same, the file is still open => no zip 68 echo `date`": file "$file" not yet closed => continue" >> $logfile 69 continue 70 fi 71 else 72 # if the origfile doesn't exist, the data was probably written not on daq but on data 73 echo `date`": file "$file" was probably taken on data and not daq " >> $logfile 74 fi 75 41 76 echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile 42 77 # zip file to stdout and pipe it to outputfile 43 78 if pigz -1 -c -f $file > $zipfiletmp; 44 79 then 80 # if successful, move temporary to final zipfile 45 81 mv -v $zipfiletmp $zipfile >> $logfile 46 82 else 83 # if not successful, remove temporary zipfile 47 84 rm -v $zipfiletmp >> $logfile 48 85 fi 49 86 done 87 88
Note:
See TracChangeset
for help on using the changeset viewer.