From: Eric Bollengier Date: Wed, 6 Jan 2021 14:48:29 +0000 (+0100) Subject: Fix org#2587 Improve btraceback output X-Git-Tag: Release-11.3.2~932 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6899e12c9b9d9af0f49ffcec9e97eefbe1af03c7;p=thirdparty%2Fbacula.git Fix org#2587 Improve btraceback output Reported by Carsten At Debian we had bug reports because of the emails that btraceback sends. Apparently the users were confused because of a lack of explanation in the email. --- diff --git a/bacula/scripts/btraceback.in b/bacula/scripts/btraceback.in index f922aa90e..532c89726 100755 --- a/bacula/scripts/btraceback.in +++ b/bacula/scripts/btraceback.in @@ -34,6 +34,12 @@ WD="$3" if [ "$WD" = "" ]; then WD=/tmp fi + +# Start constructing message. Point to log files for better user +# experience, append backtrace or message about missing debugger later +echo "Check the log files for more information." > ${WD}/bacula.$2.traceback +echo "" >> ${WD}/bacula.$2.traceback + case `uname -s` in SunOS) # @@ -57,14 +63,17 @@ SunOS) elif [ ! -z "${MDB}" ]; then ${MDB} -u -p $2 < @scriptdir@/btraceback.mdb >> ${WD}/bacula.$2.traceback 2>&1 fi - PNAME="${PNAME} on `hostname`" - cat ${WD}/bacula.$2.traceback \ - | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula DBX traceback of ${PNAME}" @dump_email@ ;; *) - gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $2 >> ${WD}/bacula.$2.traceback 2>&1 - PNAME="${PNAME} on `hostname`" - cat ${WD}/bacula.$2.traceback \ - | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula GDB traceback of ${PNAME}" @dump_email@ + which gdb > /dev/null 2>&1 && GDB=`which gdb` || GDB='' + if [ ! -z "${GDB}" ]; then + gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $2 >> ${WD}/bacula.$2.traceback 2>&1 + else + echo "Please install a debugger (gdb) to receive a traceback." >> ${WD}/bacula.$2.traceback 2>&1 + fi ;; esac + +PNAME="${PNAME} on `hostname`" +cat ${WD}/bacula.$2.traceback \ + | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula traceback. Process crashed ${PNAME}" @dump_email@