-
Notifications
You must be signed in to change notification settings - Fork 11
/
catmail.ksh
66 lines (49 loc) · 1.3 KB
/
catmail.ksh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/ksh
###
## catmail
##
## Reads files and sends them via email.
## Takes a file name as an argument on the command line.
## To send multiple files: Comment out FILES lines,
## uncomment lines and list files in $DATFILE.
##
## Submitter: Gideon Rasmussen
## Submitter Email: [email protected]
FILE=$1
SRVNM=`uname -n`
#DATFILE=/opt/admin/scripts/catmail.dat
if [ -z "$FILE" ]; then
echo " "
echo "Syntax: $0 [file]"
echo " "
exit 1
fi
### Uncomment out following 3 commented
### lines for multiple files read in from
### $DATFILE above
#while read -r FILE
#do
if [ -f $FILE ]; then
mail $MAILADD <<EOF
From: $0
To: $MAILADD
Subject: $FILE on $SRVNM
`cat $FILE`
EOF
else
echo "$FILE : File not found."
fi
#done < $DATFILE
exit 0
##############################################################################
### 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 2006 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
##############################################################################