diff --git a/bin/pt-ioprofile b/bin/pt-ioprofile index c9bb3c99..6a2609ab 100755 --- a/bin/pt-ioprofile +++ b/bin/pt-ioprofile @@ -443,9 +443,13 @@ rm_tmpdir() { # ########################################################################### # alt_cmds package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/bash/alt_cmds.sh +# t/lib/bash/alt_cmds.sh +# See https://launchpad.net/percona-toolkit for more information. # ########################################################################### -# seq N, return 1, ..., 5 _seq() { local i="$1" awk "BEGIN { for(i=1; i<=$i; i++) print i; }" @@ -466,8 +470,6 @@ _lsof() { } _which() { - # which on CentOS is aliased to a cmd that prints extra stuff. - # Also, if the cmd isn't found, a msg is printed to stderr. [ -x /usr/bin/which ] && /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' } diff --git a/bin/pt-stalk b/bin/pt-stalk index 5d8fa048..53a7b684 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -631,7 +631,7 @@ collect() { local d="$1" # directory to save results in local p="$2" # prefix for each result file - local mysqld_pid=$(_pidof mysqld | head -n1) + local mysqld_pid=$(_pidof mysqld | awk '{print $1; exit;}') if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then if $CMD_PMAP --help 2>&1 | grep -- -x >/dev/null 2>&1 ; then @@ -783,7 +783,7 @@ collect() { $CMD_OPCONTROL --stop $CMD_OPCONTROL --dump - local oprofiled_pid=$(_pidof oprofiled) + local oprofiled_pid=$(_pidof oprofiled | awk '{print $1; exit;}') if [ "$oprofiled_pid" ]; then kill $oprofiled_pid else diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index ee1b5965..9cba7cef 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -49,7 +49,7 @@ collect() { local p="$2" # prefix for each result file # Get pidof mysqld. - local mysqld_pid=$(_pidof mysqld | head -n1) + local mysqld_pid=$(_pidof mysqld | awk '{print $1; exit;}') # Get memory allocation info before anything else. if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then @@ -236,7 +236,7 @@ collect() { $CMD_OPCONTROL --stop $CMD_OPCONTROL --dump - local oprofiled_pid=$(_pidof oprofiled) + local oprofiled_pid=$(_pidof oprofiled | awk '{print $1; exit;}') if [ "$oprofiled_pid" ]; then kill $oprofiled_pid else