Created
May 3, 2009 05:21
-
-
Save posulliv/105856 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ] | |
then | |
echo "Incorrect number of arguments" | |
echo "Usage" | |
echo "./script ROOT_DIR_OF_POSTGRES_INSTALL" | |
exit 1 | |
fi | |
bin_dir=$1 | |
if [ ! -d ${bin_dir} ] | |
then | |
echo "PostgreSQL installation directory does not exist!" | |
exit 1 | |
fi | |
proc=`ps -ef | \ | |
grep postgres: | \ | |
grep -v -e 'grep postgres:' \ | |
-e 'postgres: stats' \ | |
-e 'postgres: wal' \ | |
-e 'postgres: archiver' \ | |
-e 'postgres: logger' \ | |
-e 'postgres: autovacuum' \ | |
-e 'postgres: writer' | \ | |
tee /dev/tty | \ | |
awk '{print $2}'` | |
if [ `echo "$proc" | wc -w` -eq 1 ] | |
then | |
exec gdb ${bin_dir}/bin/postgres -silent "$proc" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment