#!/bin/sh # # save as email-crash.sh # run as "./email-crash.sh <your-executable-name> <your-email-address> <coredump dir>" # /usr/bin/gdb -batch -ex "set pagination off" -ex "bt full" $1 `ls -Art $3/*core* | tail -n 1` | grep -v ^"No stack."$ | mail -s "A wild crash has arrived: stack trace attached" $2
When your program crashes, you want a way to get the stack trace (backtrace) to a developer.
This script will do it simply using
./email-crash.sh ./bot [email protected] /var/tmp/cores