Last change
on this file since 12551 was 12547, checked in by Daniela Dorner, 13 years ago |
added (script to zip raw data on data)
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | year=`date +%Y --date="-1day"`
|
---|
4 | month=`date +%m --date="-1day"`
|
---|
5 |
|
---|
6 | today=`date +%F`
|
---|
7 | logfile=/home/`whoami`/DataCheck/log/ZipRaw$today.log
|
---|
8 |
|
---|
9 | rawdir=/loc_data/raw/$year/$month
|
---|
10 | echo `date`": processing files in "$rawdir >> $logfile
|
---|
11 |
|
---|
12 | #find all directories in $rawdir
|
---|
13 | dirs=`find $rawdir -type d | sort`
|
---|
14 |
|
---|
15 | echo `date`": create missing directories in /loc_data/zipraw/$year/$month" >> $logfile
|
---|
16 | for dir in $dirs
|
---|
17 | do
|
---|
18 | zipdir=`echo $dir | sed -e 's/raw/zipraw/'`
|
---|
19 | # check if output directory for zip already exists
|
---|
20 | if [ -d $zipdir ]
|
---|
21 | then
|
---|
22 | continue
|
---|
23 | fi
|
---|
24 | # create output directory for zip
|
---|
25 | mkdir -pv $zipdir >> $logfile
|
---|
26 | done
|
---|
27 |
|
---|
28 | echo `date`": finding files to be zipped in $rawdir..." >> $logfile
|
---|
29 | fitsfiles=`find $rawdir -type f -name '*fits' | sort -r`
|
---|
30 |
|
---|
31 | echo `date`": zipping files in $rawdir..." >> $logfile
|
---|
32 | for file in $fitsfiles
|
---|
33 | do
|
---|
34 | zipfile=`echo $file | sed -e 's/raw/zipraw/' -e 's/fits/fits.gz/'`
|
---|
35 | zipfiletmp=`echo $file | sed -e 's/raw/zipraw/' -e 's/fits/fits.tmp.gz/'`
|
---|
36 | # check if zipped file already exists
|
---|
37 | if [ -e $zipfile ]
|
---|
38 | then
|
---|
39 | continue
|
---|
40 | fi
|
---|
41 | echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile
|
---|
42 | # zip file to stdout and pipe it to outputfile
|
---|
43 | if pigz -1 -c -f $file > $zipfiletmp;
|
---|
44 | then
|
---|
45 | mv -v $zipfiletmp $zipfile >> $logfile
|
---|
46 | else
|
---|
47 | rm -v $zipfiletmp >> $logfile
|
---|
48 | fi
|
---|
49 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.