File: cfmailfilter

package info (click to toggle)
cfengine 1.4.9-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 3,540 kB
  • ctags: 1,861
  • sloc: ansic: 25,408; sh: 1,708; perl: 1,088; lex: 690; makefile: 435; lisp: 182; yacc: 101; csh: 24
file content (33 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
#
# Script which concatenates email from cfengine
# avoiding repetetive messages
#
# MB 23/7/97
#
#

PATH=/usr/bin:/bin:/sbin ; export PATH

tmpfile=/tmp/new-mail-from-cfengine
cftmpdir=/tmp

cat > $tmpfile

machineline=`grep Subject: $tmpfile`
machine=`echo $machineline | sed s/[\ -/]/_/g | cut -d: -f2`

touch $cftmpdir/$machine
egrep '^cfengine:.*' $tmpfile > $cftmpdir/$machine.new

if test `diff $cftmpdir/$machine.new $cftmpdir/$machine | wc -l` -ne 0; then

 mv $cftmpdir/$machine.new $cftmpdir/$machine

 #
 # This next piece could be replaced by a cgi script to show the results
 #

 ( echo "$machineline"; echo "" ; cat $cftmpdir/$machine ) | mail mark@iu.hioslo.no

fi