#!/bin/sh # # Script to do a stackdump of a Bacula daemon/program. # # We attempt to attach to running program # # Arguments to this script are # $1 = path to executable # $2 = main pid of running program to be traced back. # PNAME=`basename $1` if test `uname -s` = SunOS ; then gcore -o /var/bacula/working/${PNAME} $2 dbx $1 $2 &1 \ | /sbin/bsmtp -h localhost -f root@localhost -s "Bacula DBX traceback of ${PNAME}" root@localhost else gdb -quiet -batch -x /etc/btraceback.gdb $1 $2 2>&1 \ | /sbin/bsmtp -h localhost -f root@localhost -s "Bacula GDB traceback of ${PNAME}" root@localhost fi