Skip to content

Instantly share code, notes, and snippets.

@rgarner
Created June 10, 2014 07:48
Show Gist options
  • Save rgarner/f91400915180a5c82242 to your computer and use it in GitHub Desktop.
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
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