-
Notifications
You must be signed in to change notification settings - Fork 11
/
findcores.sh
44 lines (37 loc) · 1.22 KB
/
findcores.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/ksh
# find core dumps and mail file info to root
# Des Warren, Paul Warren
# 7/3/01
### findcores.sh does a search for core files, runs a file
### command on them to see which program created the core,
### and mails the results before deleting the core.
###
### Submitter Name: Des Warren
### Submitter Email: [email protected]
### Find the core files
find / -name core -type f > /tmp/cores$$
function mailcores
{
for i in $( </tmp/cores$$ )
do
echo "" >> /tmp/mailcores
file $i >> /tmp/mailcores
echo "" >> /tmp/mailcores
rm $i
done
mailx -s "core on `uname -n` " root < /tmp/mailcores
rm /tmp/mailcores
rm /tmp/cores$$
}
[[ -s /tmp/cores$$ ]] && mailcores
##############################################################################
### This script is submitted to BigAdmin by a user of the BigAdmin community.
### Sun Microsystems, Inc. is not responsible for the
### contents or the code enclosed.
###
###
### Copyright 2007 Sun Microsystems, Inc. ALL RIGHTS RESERVED
### Use of this software is authorized pursuant to the
### terms of the license found at
### http://www.sun.com/bigadmin/common/berkeley_license.html
##############################################################################