Created
June 10, 2014 07:48
-
-
Save rgarner/f91400915180a5c82242 to your computer and use it in GitHub Desktop.
Track the progress of an index build for a table in a mysql database directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -alh | awk -v table_name=$1 ' | |
BEGIN { | |
if(table_name == "") { | |
print "table_name required" | |
exit(1) | |
} | |
myi = table_name ".MYI" | |
myd = table_name ".MYD" | |
} | |
$9 ~ /#.*MYD/ { | |
myd_at = $5 | |
} | |
$9 == myd { | |
myd_total = $5 | |
} | |
$9 ~ /#.*MYI/ { | |
myi_at = $5 | |
} | |
$9 == myi { | |
myi_total = $5 | |
} | |
END { | |
if((myd_at == "") || (myi_at == "")) { | |
print "No operation in progress." | |
exit(1) | |
} | |
print myd_at "/" myd_total | |
print myi_at "/" myi_total | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment