1 | #!/bin/bash
|
---|
2 | echo "Please specify the tape number (e.g. 3MG005L3)."
|
---|
3 | read no
|
---|
4 | echo "Thank you. Your query is being processed. This may take some time."
|
---|
5 |
|
---|
6 | checkpath=/home/lapalma/tapecont/cont/muxdata/checksums
|
---|
7 | file=/home/lapalma/tapecont/cont/muxdata/tape_${no}.md5
|
---|
8 | if [ ! -f $file ]
|
---|
9 | then
|
---|
10 | echo "tape $file not found."
|
---|
11 | exit
|
---|
12 | fi
|
---|
13 |
|
---|
14 | date | tee ${checkpath}/tape_${no}.md5.lapalma | tee ${checkpath}/tape_${no}.md5.wue
|
---|
15 |
|
---|
16 | # read the tapecont file line by line
|
---|
17 | while read line
|
---|
18 | do
|
---|
19 | muxchk=`echo $line | cut -d/ -f1`
|
---|
20 | # only check muxdata, not cc-, caco- or drivelog-files
|
---|
21 | if [ "$muxchk" = "muxdata" ]
|
---|
22 | then
|
---|
23 | sum=($line)
|
---|
24 | # reformat the files and checksums correctly and compare them
|
---|
25 | echo "${sum[1]} ${sum[0]}" >> ${checkpath}/tape_${no}.md5.lapalma
|
---|
26 |
|
---|
27 | ssh -nx phoenix nice -n 19 /opt/csw/bin/gmd5sum /magic/datacenter/fromtape/${sum[0]} | sed -e 's/\/magic\/datacenter\/fromtape\///' >> ${checkpath}/tape_${no}.md5.wue
|
---|
28 | #md5sum /magic/datacenter/fromtape/${sum[0]} | sed -e 's/\/magic\/datacenter\/fromtape\///' >> ${checkpath}/tape_${no}.md5.wue
|
---|
29 | fi
|
---|
30 | done < $file
|
---|
31 |
|
---|
32 | date | tee -a ${checkpath}/tape_${no}.md5.lapalma | tee -a ${checkpath}/tape_${no}.md5.wue
|
---|
33 |
|
---|
34 | if [ ! -f ${checkpath}/tape_${no}.md5.lapalma ] || [ ! -f ${checkpath}/tape_${no}.md5.wue ]
|
---|
35 | then
|
---|
36 | echo "No output files written! Something went wrong..."
|
---|
37 | exit
|
---|
38 | fi
|
---|
39 |
|
---|
40 | echo "Wrote checksums to ${checkpath}/tape_${no}.md5.lapalma and ${checkpath}/tape_${no}.md5.wue. Comparing now."
|
---|
41 |
|
---|
42 |
|
---|
43 | # check for differences in the checksums
|
---|
44 | output=`diff ${checkpath}/tape_${no}.md5.lapalma ${checkpath}/tape_${no}.md5.wue`
|
---|
45 |
|
---|
46 | if [ "$output" = "" ]
|
---|
47 | then
|
---|
48 | echo "All checksums are ok!"
|
---|
49 | else
|
---|
50 | echo -e "The files are not identical! diff found the following differences:\n$output"
|
---|
51 | fi
|
---|
52 |
|
---|
53 | echo "program terminated."
|
---|