Fix bug #6040 - Calling Samba print server with an aliased DNS-name fails.
[Samba.git] / packaging / Debian / debian-sarge / panic-action
blob13f773c1ef8cd626768cbde7a4ea41309798ef7c
1 #!/bin/sh
3 # Redirect all output to our mail command
5 # We must be given a pid to look at
6 if [ -z "$1" ]; then
7 echo "$0 called with no arguments."
8 exit 1
9 fi
11 if [ ! -d "/proc/$1" ]; then
12 echo "$0: No such process: $1"
13 exit 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)."
22 echo
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."
29 exit 1
32 # No debugger
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."
38 exit 1
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."
46 echo
47 gdb -x /etc/samba/gdbcommands -batch "$BINARYNAME" "$1"
48 ) | mail -s "Segfault in Samba" root