diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-31 19:19:35 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-31 19:19:35 +0000 |
commit | 67638ecf82e49f68a1c90c10170ec60f714907ef (patch) | |
tree | 8770050f181e9dc1dde9af83fdf69e1971857ddb /contrib | |
parent | af2a61d0b20364c25f73bbf1ed5f3ed82e2d6156 (diff) |
This probably isn't super-general, but it's a first stab at using kill -11 to generate a core file instead of gcore.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@77842 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/scripts/ast_grab_core | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/contrib/scripts/ast_grab_core b/contrib/scripts/ast_grab_core index 8f405ebdd..4de519c7f 100644 --- a/contrib/scripts/ast_grab_core +++ b/contrib/scripts/ast_grab_core @@ -3,8 +3,19 @@ # lame quickie script to snarf a core of a hung asterisk process. # bugs to ast_grab_core, blinky-lights.org (derrick daugherty) +# we have found that gcore doesn't yield as useful a core file +# as that yielded by a signal-caused core dump. So we are going to change +# the strategy to sending a SEGV signal to the asterisk process, +# and have it 'burn to the ground', leaving behind a core file. +# the main difference is that you cannot control where the +# core file will end up. We will assume that safe_asterisk was +# used to start asterisk, and the core file should therefore end +# up in /tmp (because safe_asterisk cd's there before starting asterisk). +# if this is not the case, set DUMPDIR to the place where the core +# file can be found. + DATE=`date +%Y%m%d%H%M` -DUMPDIR=/var/tmp +DUMPDIR=/tmp HOSTNAME=`hostname` ADMINEMAIL="root@localhost" @@ -27,20 +38,16 @@ echo \*\*\* WARNING \*\*\* If the system is not already locked this will cause echo \*\*\* WARNING \*\*\* process to STOP while memory is dumped to disk. echo -/usr/bin/gdb > /dev/null << EOF - attach ${PID} - gcore ${DUMPDIR}/asterisk_${DATE}.core.${PID} - detach - quit -EOF +/usr/bin/kill -11 ${PID} -echo Snarfed! ${DUMPDIR}/asterisk_${DATE}.core.${PID} +echo Snarfed! ${DUMPDIR}/core.${PID} echo echo Trying for a backtrace of the captured core. -/usr/bin/gdb /usr/sbin/asterisk ${DUMPDIR}/asterisk_${DATE}.core.${PID} > /tmp/gdb_dump.${PID} 2> /dev/null << EOF +/usr/bin/gdb /usr/sbin/asterisk ${DUMPDIR}/core.${PID} > /tmp/gdb_dump.${PID} 2> /dev/null << EOF set prompt \n +set print pretty\n echo --------------------------------------------------------------------------------\n echo INFO THREAD info thread @@ -56,7 +63,7 @@ echo Done trying for a bt. echo Notifying admins of the core. -/usr/bin/mail -s "${HOSTNAME} core dumped at ${DUMPDIR}/asterisk_${DATE}.core.${PID}" ${ADMINEMAIL} < /tmp/gdb_dump.${PID} +/usr/bin/mail -s "${HOSTNAME} core dumped at ${DUMPDIR}/core.${PID}" ${ADMINEMAIL} < /tmp/gdb_dump.${PID} /bin/rm /tmp/gdb_dump.${PID} echo Done. echo |