Removed extra spaces in lsof output, so mysql_pid detection does not depend on lsof format

This commit is contained in:
Sveta Smirnova
2024-06-05 12:59:13 +03:00
parent 5e72127ebf
commit 8dd0f28f64
3 changed files with 1 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ _pidof() {
_lsof() {
local pid="$1"
if ! lsof -p $pid 2>/dev/null; then
/bin/ls -l /proc/$pid/fd 2>/tmp/lsof_test #/dev/null
/bin/ls -l /proc/$pid/fd 2>/dev/null
fi
}

View File

@@ -123,9 +123,6 @@ collect_mysql_data_one() {
if [ ! "$OPT_MYSQL_ONLY" ]; then
port=$($CMD_MYSQL $EXT_ARGV -ss -e 'SELECT @@port')
mysqld_pid=$(lsof -i ":${port}" | grep -i listen | tr -s ' ' | cut -f 2 -d" ")
echo "MySQL PID: $mysqld_pid" > /tmp/mysql_pid_lsof
lsof_pid=$(lsof -i ":${port}")
echo "lsof for MySQl PID: $lsof_pid" >> /tmp/mysql_pid_lsof
fi
# Get memory allocation info before anything else.