Revision: | 1.1 |
Committed: | Tue Feb 28 11:54:35 2012 UTC (13 years, 2 months ago) by paus |
Content type: | application/x-sh |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, HEAD |
Log Message: | Last updates. |
# | User | Rev | Content |
---|---|---|---|
1 | paus | 1.1 | #!/bin/bash |
2 | #=================================================================================================== | ||
3 | # Call file check on hadoop and store the corrupted files and files with missing blocks. | ||
4 | #=================================================================================================== | ||
5 | |||
6 | # read command line parameters | ||
7 | BROKEN_FILE_LIST="broken.txt" | ||
8 | if [ "$1" != "" ] | ||
9 | then | ||
10 | BROKEN_FILE_LIST="$1" | ||
11 | fi | ||
12 | rm -f $BROKEN_FILE_LIST | ||
13 | touch $BROKEN_FILE_LIST | ||
14 | |||
15 | DEBUG="" | ||
16 | if [ "$2" != "" ] | ||
17 | then | ||
18 | DEBUG="$1" | ||
19 | fi | ||
20 | |||
21 | # make a file with the fsck output | ||
22 | hadoop fsck / > /tmp/hadoop-fsck.$$ | ||
23 | |||
24 | # loop over the hadoop fsck output and find relevant files | ||
25 | while read line | ||
26 | do | ||
27 | |||
28 | if [ "`echo $line | egrep \(CORRUPT\|MISSING\)`" != "" ] && | ||
29 | [ "`echo $line | grep ^/cmsprod`" != "" ] | ||
30 | then | ||
31 | fullFile=`echo $line | cut -d ':' -f1 | sed "s#^#/mnt/hadoop#"` | ||
32 | if [ "$DEBUG" != "" ] | ||
33 | then | ||
34 | echo "LINE: $line" | ||
35 | echo "$fullFile" | ||
36 | echo "" | ||
37 | fi | ||
38 | echo "$fullFile" >> $BROKEN_FILE_LIST | ||
39 | fi | ||
40 | |||
41 | done < /tmp/hadoop-fsck.$$ |