forked from Percona-QA/percona-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ldd_files.sh
executable file
·24 lines (18 loc) · 886 Bytes
/
ldd_files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Created by Roel Van de Paar, Percona LLC
# This script quickly gathers all ldd dep files for mysqld in the current directory into the current directory
if [ ! -r ./mysqld -a ! -r ./xtrabackup ]; then
echo "Assert: ./mysqld nor ./xtrabackup exist?"
exit 1
fi
if [ -r ./mysqld ]; then
ldd mysqld | sed 's|(.*||;s|=>[ \t]*$||;s|.*=>||;s|[ \t\n\r]*||;s|[^0-9a-zA-Z]$||' | grep -v "^[a-zA-Z]" | xargs -I_ cp _ .
CORE=`ls -1 *core* 2>&1 | head -n1 | grep -v "No such file"`
if [ -f "$CORE" -a "" != "${CORE}" ]; then
mkdir lib64
gdb ./mysqld $CORE -ex "info sharedlibrary" -ex "quit" 2>&1 | grep "0x0" | grep -v "lib.mysql.plugin" | sed 's|.*/lib64|/lib64|' | xargs -I_ cp _ ./lib64/
fi
fi
if [ -r ./xtrabackup ]; then
ldd xtrabackup | sed 's|(.*||;s|=>[ \t]*$||;s|.*=>||;s|[ \t\n\r]*||;s|[^0-9a-zA-Z]$||' | grep -v "^[a-zA-Z]" | xargs -I_ cp _ .
fi