r8384: merging clutter fixes from release branch
[samba.git] / examples / scripts / debugging / solaris / solaris-oops.sh
1 #!/bin/sh
2 #
3 # solaris_panic_action -- capture supporting information after a failure
4 #
5 ProgName=`basename $0`
6 LOGDIR=/usr/local/samba/var
7
8 main() {
9         pid=$1
10
11         if [ $# -lt 1 ]; then
12                 say "$ProgName error: you must supply a pid"
13                 say "Usage: $0 pid"
14                 exit 1
15         fi
16         cat >>$LOGDIR/log.solaris_panic_action <<!
17
18 `date`
19 State information and vountary core dump for process $pid
20
21 Related processes were:
22 `/usr/bin/ptree $pid`
23
24 Stack(s) were:
25 `/usr/bin/pstack $pid`
26
27 Flags were:
28 `/usr/bin/pflags $pid`
29
30 Credentials were:
31 `/usr/bin/pcred $pid`
32
33 Libraries used were:
34 `/usr/bin/pldd $pid`
35
36 Signal-handler settings were:
37 `/usr/bin/psig $pid`
38
39 Files and devices in use were:
40 `/usr/bin/pfiles $pid`
41
42 Directory in use was:
43 `/usr/bin/pwdx $pid`
44
45
46 A voluntary core dump was placed in /var/tmp/samba_solaris_panic_action_gcore.$pid
47 `gcore -o /var/tmp/samba_solaris_panic_action_gcore $pid`
48 !
49 }
50
51 say() {
52         echo "$@" 1>&2
53 }
54
55 main "$@"