From 2d1c9c9d16c9d1f6e5dba4a50d623d14c66ff899 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 16 Jan 2020 23:18:53 +0100 Subject: bin/bisect-database-dumps: make used dumps more selectable --- bin/bisect-database-dumps | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'bin/bisect-database-dumps') diff --git a/bin/bisect-database-dumps b/bin/bisect-database-dumps index d788d1f..f92e835 100755 --- a/bin/bisect-database-dumps +++ b/bin/bisect-database-dumps @@ -3,8 +3,11 @@ # bisect through the database dumps to see when a specific thing # appeared first +expr="$1" +shift + dumps=$( - find '/data/backup/mysql' -mindepth 1 -maxdepth 1 -name 'database-*.xz' -exec ls -tr {} + \ + find '/data/backup/mysql' -mindepth 1 -maxdepth 1 -name 'database-*.xz' "$@" -exec ls -tr {} + \ | sort ) @@ -13,8 +16,8 @@ has=$( tail -n1 ) -if ! xzgrep -q "$@" "${has}"; then - >&2 printf 'cannot find "%s" in the latest dump - swapping directions\n' "$*" +if ! xzgrep -q "${expr}" "${has}"; then + >&2 printf 'cannot find "%s" in the latest dump - swapping directions\n' "${expr}" dumps=$( printf '%s\n' "${dumps}" | \ tac @@ -23,7 +26,7 @@ if ! xzgrep -q "$@" "${has}"; then printf '%s\n' "$dumps" | \ tail -n1 ) - if ! xzgrep -q "$@" "${has}"; then + if ! xzgrep -q "${expr}" "${has}"; then >&2 printf 'cannot find "%s" in the earliest dump either - swapping directions did not help\n' "$*" exit 1 fi @@ -34,7 +37,7 @@ has_not=$( head -n1 ) -if xzgrep -q "$@" "${has_not}"; then +if xzgrep -q "${expr}" "${has_not}"; then >&2 printf 'first dump does also have "%s"\n' "$*" exit 1 fi @@ -57,7 +60,7 @@ while [ "${count}" -gt 2 ]; do ' ) >&2 printf 'looking into "%s" ... ' "${pivot}" - if xzgrep -q "$@" "${pivot}"; then + if xzgrep -q "${expr}" "${pivot}"; then >&2 printf 'has' has="${pivot}" else -- cgit v1.2.3-54-g00ecf