|
|
1.1 root 1: #! /bin/sh -
2: # send mail to a user for the given job
3: # option -f: say this is the final report
4: exec 2>> %SDIR%/log
5:
6: PATH=%LDIR%:/bin:/usr/bin:/usr/ucb:/usr/bsd
7: cd %SDIR%
8:
9: if [ "x$1" = x-f ]
10: then
11: shift
12: final=1
13: else
14: final=0
15: fi
16:
17: if [ $# != 1 ]
18: then
19: exit 1
20: fi
21:
22: user=`ls -ld $1 | awk '{print $3}'`
23: host=`hostname`
24:
25: trap 'rm -f /tmp/genmail.$$' 0 1 2 3
26: rm -f /tmp/genmail.$$
27:
28: if [ $final = 0 ]
29: then
30: echo current status report of dist job $host!$1
31: else
32: echo final status report of dist job $host!$1
33: fi > /tmp/genmail.$$
34:
35: while read num sys
36: do
37: if [ -f $1/$num.mail ]
38: then
39: :
40: else
41: if [ -s $1/$num.done ]
42: then
43: echo $sys completed with errors:
44: sed 's/^/ /' $1/$num.done
45: touch $1/$num.mail
46: elif [ -f $1/$num.done ]
47: then
48: echo $sys completed successfully.
49: touch $1/$num.mail
50: else
51: echo $sys not completed.
52: fi
53: fi
54: done < $1/ctl >> /tmp/genmail.$$
55:
56: mail $user < /tmp/genmail.$$
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.