Files
percona-toolkit/sandbox/load-sakila-db
2012-11-28 17:55:35 +00:00

37 lines
922 B
Bash
Executable File

#!/bin/sh
die() {
echo
for msg; do
echo $msg
done
exit 1
}
# ###########################################################################
# Sanity check the cmd line options.
# ###########################################################################
if [ $# -lt 1 ]; then
die "Usage: load-sakila-db PORT"
fi
PORT=$1
if [ ! -d "/tmp/$PORT" ]; then
die "MySQL test server does not exist: /tmp/$PORT"
fi
# ###########################################################################
# Sanity check the environment.
# ###########################################################################
if [ -z "$PERCONA_TOOLKIT_BRANCH" ]; then
die "PERCONA_TOOLKIT_BRANCH environment variable is not set."
fi
if [ ! -d "$PERCONA_TOOLKIT_BRANCH" ]; then
die "Invalid PERCONA_TOOLKIT_BRANCH directory: $PERCONA_TOOLKIT_BRANCH"
fi
/tmp/$PORT/use < $PERCONA_TOOLKIT_BRANCH/sandbox/sakila.sql
exit $?