3 type mail >/dev/null 2>&1 || exit 0
5 # Redirect all output to our mail command
7 # We must be given a pid to look at
9 echo "$0 called with no arguments."
13 if [ ! -d "/proc/$1" ]; then
14 echo "$0: No such process: $1"
18 # Find out what binary we're debugging
19 BINARYNAME=`readlink "/proc/$1/exe"`
21 # Generic header for our email
22 echo "The Samba 'panic action' script, $0,"
23 echo "was called for pid $1 ($BINARYNAME)."
26 if [ -z "$BINARYNAME" ]; then
27 echo "This means there was a problem with the program, such as a segfault."
28 echo "However, the executable could not be found for process $1."
29 echo "It may have died unexpectedly, or you may not have permission to"
30 echo "debug the process."
35 if [ ! -x /usr/bin/gdb ]; then
36 echo "This means there was a problem with the program, such as a segfault."
37 echo "However, gdb was not found on your system, so the error could not be"
38 echo "debugged. Please install the gdb package so that debugging information is"
39 echo "available the next time such a problem occurs."
43 echo "Below is a backtrace for this process generated with gdb, which shows"
44 echo "the state of the program at the time the error occurred. "
46 echo "If the problem persists, you are encouraged to first install the "
47 echo "samba-dbg package which contains the debugging symbols for samba "
48 echo "binaries. Then, submit the provided information as a bug report to Ubuntu."
49 echo "For information about the procedure for submitting bug reports, please"
50 echo "see http://www.ubuntulinux.org/support/bugs/document_view"
52 gdb -x /etc/samba/gdbcommands -batch "$BINARYNAME" "$1"
53 ) | mail -s "Segfault in Samba" root