3 # Redirect all output to our mail command
5 # We must be given a pid to look at
7 echo "$0 called with no arguments."
11 if [ ! -d "/proc/$1" ]; then
12 echo "$0: No such process: $1"
16 # Find out what binary we're debugging
17 BINARYNAME
=`readlink "/proc/$1/exe"`
19 # Generic header for our email
20 echo "The Samba 'panic action' script, $0,"
21 echo "was called for pid $1 ($BINARYNAME)."
24 if [ -z "$BINARYNAME" ]; then
25 echo "This means there was a problem with the program, such as a segfault."
26 echo "However, the executable could not be found for process $1."
27 echo "It may have died unexpectedly, or you may not have permission to"
28 echo "debug the process."
33 if [ ! -x /usr
/bin
/gdb
]; then
34 echo "This means there was a problem with the program, such as a segfault."
35 echo "However, gdb was not found on your system, so the error could not be"
36 echo "debugged. Please install the gdb package so that debugging information is"
37 echo "available the next time such a problem occurs."
41 echo "Below is a backtrace for this process generated with gdb, which shows"
42 echo "the state of the program at the time the error occured. You are"
43 echo "encouraged to submit this information as a bug report to Debian. For"
44 echo "information about the procedure for submitting bug reports , please see"
45 echo "http://www.debian.org/Bugs/Reporting or the reportbug(1) manpage."
47 gdb
-x /etc
/samba
/gdbcommands
-batch "$BINARYNAME" "$1"
48 ) |
mail -s "Segfault in Samba" root