Changeset 12970 for trunk/DataCheck
- Timestamp:
- 02/29/12 12:39:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/ZipRawData.sh
r12760 r12970 1 1 #!/bin/bash 2 2 3 today=`date +%F` 4 logfile=/home/`whoami`/DataCheck/log/ZipRaw$today.log 3 # this script has been written to run on La Palma on the machine data 4 # i.e. paths are only working on this machine 5 6 source `dirname $0`/Sourcefile.sh 7 printprocesslog "INFO starting "$0 8 9 logfile=$runlogpath"/ZipRawLP-"$datetime".log" 10 date >> $logfile 5 11 6 12 # get last 3 nights … … 11 17 12 18 # setup to use ftools 13 export HEADAS=/opt/heasoft-6.11/x86_64-unknown-linux-gnu-libc2.13-0/14 19 source $HEADAS/headas-init.sh 15 20 … … 18 23 do 19 24 echo "" >> $logfile 2>&1 20 echo "" >> $logfile 2>&121 echo "" >> $logfile 2>&122 25 rawdir=/loc_data/raw/$date 23 26 echo `date`": processing files in "$rawdir >> $logfile 2>&1 27 printprocesslog "INFO processing files in "$rawdir 24 28 # check if data are available from that night 25 29 if ! [ -d $rawdir ] 26 30 then 27 31 echo `date`": no data available in "$rawdir >> $logfile 2>&1 32 printprocesslog "INFO no data available in "$rawdir 28 33 continue 29 34 fi … … 32 37 then 33 38 # create output directory for zip 34 m kdir -pv$zipdir >> $logfile 2>&139 makedir $zipdir >> $logfile 2>&1 35 40 fi 36 41 37 42 # find all fits-files starting with the oldest file 38 43 echo `date`": finding files to be zipped in $rawdir..." >> $logfile 2>&1 44 printprocesslog "INFO finding files to be zipped in "$rawdir"..." 39 45 fitsfiles=`find $rawdir -type f -name '*fits'| sort ` 40 46 … … 42 48 then 43 49 echo `date`": no files to be zipped in $rawdir..." >> $logfile 2>&1 50 printprocesslog "INFO no files to be zipped in "$rawdir"..." 44 51 continue 45 52 fi … … 47 54 # loop to zip files 48 55 echo `date`": zipping files in $rawdir..." >> $logfile 2>&1 56 printprocesslog "INFO zipping files in "$rawdir"..." 49 57 for file in $fitsfiles 50 58 do … … 63 71 then 64 72 echo $file" is not older than $delaytime min => continue" >> $logfile 2>&1 73 printprocesslog "INFO "$file" is not older than $delaytime min => continue" 65 74 continue 66 75 fi … … 79 88 # if times are not the same, the file is still open => no zip 80 89 echo `date`": file "$file" not yet closed => continue" >> $logfile 2>&1 90 printprocesslog "WARN file "$file" not yet closed => continue" 81 91 continue 82 92 fi … … 84 94 # if the origfile doesn't exist, the data was probably written not on daq but on data 85 95 echo `date`": file "$file" was probably taken on data and not daq " >> $logfile 2>&1 96 printprocesslog "WARN file "$file" was probably taken on data and not daq " 86 97 fi 87 98 … … 99 110 100 111 echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile 2>&1 112 printprocesslog "INFO zipping "$file" to "$zipfile" ..." 101 113 # zip file to stdout and pipe it to outputfile 102 if pigz -1 -c -f $file > $zipfiletmp ;114 if pigz -1 -c -f $file > $zipfiletmp 103 115 then 104 116 # if successful, move temporary to final zipfile 117 printprocesslog "INFO move "$zipfiletmp" to "$zipfile" ..." 105 118 mv -v $zipfiletmp $zipfile >> $logfile 2>&1 106 119 else 107 120 # if not successful, remove temporary zipfile 121 printprocesslog "INFO remove "$zipfiletmp"..." 108 122 rm -v $zipfiletmp >> $logfile 2>&1 109 123 fi … … 111 125 done 112 126 echo "finished zipping..." >> $logfile 2>&1 113 127 finish
Note:
See TracChangeset
for help on using the changeset viewer.