source: branches/trigger_burst_research/Archive/checkRawFileIntegrityAndContent.sh@ 18407

Last change on this file since 18407 was 12871, checked in by lyard, 13 years ago
added more scripts
  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#!/bin/bash
2
3sourceFolder=$1
4archiveFolder=$2
5suffix=$3
6
7#are the arguments subfolders of /data00/fact-construction and /archive/fact ?
8sourceOk=`echo $sourceFolder | sed "s/data00\/fact-construction\/raw/OK/"`
9archiveOk=`echo $archiveFolder | sed "s/archive\/fact\/rev_1\/raw/OK/"`
10
11sourceOk=`echo $sourceOk | grep OK`
12archiveOk=`echo $archiveOk | grep OK`
13
14if [ "$sourceOk" == "" ]
15then
16 echo "source folder not good."
17 exit
18fi
19
20if [ "$archiveOk" == "" ]
21then
22 echo "archive folder not good"
23 exit
24fi
25
26uncompressedFolder=`echo $sourceFolder | sed "s/data00/data03/"`
27
28#do the listing of the files to be checked
29entries=`find $sourceFolder -type f -name '*.fits.gz' | sort`
30
31for entry in ${entries[@]}
32do
33 echo "$entry" >> GGfileSequence$suffix.txt
34
35 uncompressedEntry=`echo $entry | sed "s/data00/data03/"`
36 uncompressedEntry=`echo $uncompressedEntry | sed "s/.gz//"`
37 archiveEntry=`echo $entry | sed "s/data00\/fact-construction/archive\/fact\/rev_1/"`
38 corruptedFile="0"
39 if [ -f $uncompressedEntry ]
40 then
41 result=`fverify $uncompressedEntry 2>/dev/null | grep '0 error(s)'`
42 if [ "$result" == "" ]
43 then
44 if [ -f $archiveEntry ]
45 then
46 echo "$entry" >> GGcorruptFiles$suffix.txt
47 fi
48 corruptedFile="1"
49 fi
50 else
51 echo "$entry" >> GGmissingUncompressed$suffix.txt
52 echo "$entry is missing uncompressed"
53 continue
54 fi
55
56 if [ -f $archiveEntry ]
57 then
58 result=`/home_nfs/isdc/lyard/FACT++/fitsCompare $entry $archiveEntry`
59 if [ "$result" == "0" ]
60 then
61 echo "$entry" >> GGidenticalFiles$suffix.txt
62 echo "$entry is fine"
63 continue
64 fi
65 if [ "$result" == "1" ]
66 then
67 echo "$entry" >> GGdifferentFiles$suffix.txt
68 echo "$entry differs from its archived version"
69 continue
70 fi
71 if [ "$result" == "2" ]
72 then
73 echo "$entry" >> GGunexpectedErrors$suffix.txt
74 echo "$entry encountered an unexpected error"
75 continue
76 fi
77 if [ "$result" == "3" ]
78 then
79 echo "$entry" >> GGfineWithMoreRows$suffix.txt
80 echo "$entry is fine (with more rows !"
81 continue
82 fi
83 if [ "$corryuptedFile" == "1"]
84 then
85 echo "$entry is corrupted and produced unkown error $result"
86 else
87 echo "$entry produced unkown error $result"
88 fi
89 echo "$entry $result" >> GGunknownErrors$suffix.txt
90 else
91 if [ "$corruptedFile" == "1" ]
92 then
93 echo "$entry" >> GGreallymessedup$suffix.txt
94 echo "$entry is really messed up"
95 else
96 echo "$entry" >> GGmissingArchive$suffix.txt
97 echo "$entry is missing archive"
98 fi
99 fi
100done
Note: See TracBrowser for help on using the repository browser.