forked from jakdept/docker-percona-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·37 lines (33 loc) · 1.02 KB
/
run.sh
File metadata and controls
executable file
·37 lines (33 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /bin/bash
#
# Usage: $THIS pt-command [args]
#
# Run percona-toolkit commands inside docker container. Percona tools can read
# all files under the current directory. You should change directory to mysql
# log directory before execute before execute it.
#
# Example:
# cd /var/log/mysql
# $THIS pt-query-digest --limit=100% slow_query.log > slow_query.pqd
# NOTE: The slow_query.log is located in the current working directory.
#
# Environment:
# DOCKER_PERCONA_TOOLKIT: Docker image name for the percona toolkit.
# Default: yuuki0xff/percona-toolkit
# Current Value: $DOCKER_PERCONA_TOOLKIT
set -eu
# Set default value when value is not defined.
THIS=$0
: "${DOCKER_PERCONA_TOOLKIT:=yuuki0xff/percona-toolkit}"
# Show help
function help {
export THIS
export DOCKER_PERCONA_TOOLKIT
envsubst <"$THIS" |sed '1,2d; /^$/Q; s/^# \?//;'
exit 1
}
# main
if [ -z "${1:-}" ]; then
help
fi
docker run --rm -ti -v $(pwd):/mnt:ro -w /mnt "$DOCKER_PERCONA_TOOLKIT" "$@"