mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-24 02:01:42 +08:00
Check for mysql after parsing options so --help works even if mysql isn't in PATH.
This commit is contained in:
17
bin/pt-stalk
17
bin/pt-stalk
@@ -1154,15 +1154,6 @@ main() {
|
||||
if [ "${0##*/}" = "$TOOL" ] \
|
||||
|| [ "${0##*/}" = "bash" -a "$_" = "$0" ]; then
|
||||
|
||||
# Check that mysql and mysqladmin are in PATH. If not, we're
|
||||
# already dead in the water, so don't bother with cmd line opts,
|
||||
# just error and exit.
|
||||
[ -n "$(mysql --help)" ] \
|
||||
|| die "Cannot execute mysql. Check that it is in PATH."
|
||||
[ -n "$(mysqladmin --help)" ] \
|
||||
|| die "Cannot execute mysqladmin. Check that it is in PATH."
|
||||
|
||||
|
||||
# Parse command line options. We must do this first so we can
|
||||
# see if --daemonize was specified.
|
||||
mk_tmpdir
|
||||
@@ -1181,6 +1172,14 @@ if [ "${0##*/}" = "$TOOL" ] \
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check that mysql and mysqladmin are in PATH. If not, we're
|
||||
# already dead in the water, so don't bother with cmd line opts,
|
||||
# just error and exit.
|
||||
[ -n "$(mysql --help)" ] \
|
||||
|| die "Cannot execute mysql. Check that it is in PATH."
|
||||
[ -n "$(mysqladmin --help)" ] \
|
||||
|| die "Cannot execute mysqladmin. Check that it is in PATH."
|
||||
|
||||
# Now that we have the cmd line opts, check that we can actually
|
||||
# connect to MySQL.
|
||||
[ -n "$(mysql $EXT_ARGV -e 'SELECT 1')" ] \
|
||||
|
||||
Reference in New Issue
Block a user