File:  [Local Repository] / reports / sendletter.sh
Revision 1.12: download - view: text, annotated - select for diffs - revision graph
Sat Mar 6 00:57:40 2010 UTC (14 years, 2 months ago) by boris
Branches: MAIN
CVS tags: HEAD
new info

#!/bin/sh
ADDRESS="chronicles@chgk.info"
#ADDRESS=boris
PREFIX=http://letopis.chgk.info
if ( grep html results.txt > letter1.txt ) ; then
    echo "Sending notification to $ADDRESS"
    echo > letter.txt
    if [ -f letter_start.txt ]; then
	cat letter_start.txt >> letter.txt
	echo >> letter.txt
	echo >> letter.txt
    fi

    echo "Последние обновления в летописи:" >> letter.txt
    echo >> letter.txt
    for x in `cat letter1.txt`; do
	if [ -f $x ]; then
	    echo $PREFIX/$x >> letter.txt
	    head -40 $x | sed '
1,5d
s/<[^>]*>//g
s/<[^>]*$//g
s/^[^<]*>//g
s/&lt;[a-zA-Z\._0-9-]*@[a-zA-Z\._0-9-]*&gt;/<address>/g
/^[ 	]*$/d
s/^\(.*\)$/   \1/' |head -5  >>letter.txt
	    echo >> letter.txt
	fi
    done
    echo >> letter.txt
    echo "--" >> letter.txt
    echo "Ваш робот" >> letter.txt
    echo >> letter.txt
    fortune lec >> letter.txt
    mail -s "Novosti v letopisi" $ADDRESS <letter.txt
fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>