~zulcss/samba/server-dailies-3.0.37

« back to all changes in this revision

Viewing changes to packaging/Debian/debian-unstable/panic-action

  • Committer: Chuck Short
  • Date: 2010-09-28 20:24:01 UTC
  • Revision ID: zulcss@ubuntu.com-20100928202401-tgh438aoatxv3zp3
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Redirect all output to our mail command
 
4
(
 
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
 
10
 
 
11
        if [ ! -d "/proc/$1" ]; then
 
12
                echo "$0: No such process: $1"
 
13
                exit 1
 
14
        fi
 
15
 
 
16
        # Find out what binary we're debugging
 
17
        BINARYNAME=`readlink "/proc/$1/exe"`
 
18
 
 
19
        # Generic header for our email
 
20
        echo "The Samba 'panic action' script, $0,"
 
21
        echo "was called for pid $1 ($BINARYNAME)."
 
22
        echo
 
23
 
 
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
 
30
        fi
 
31
 
 
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
 
39
        fi
 
40
 
 
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