Sendmail Mail Triger

(0 comments)

.procmailrc 对邮件进行过滤并交给程序来处理。

# We shouldn't be running as a privileged user, but just in case,
# make sure we drop any privileges we have
DROPPRIVS=1

:0 Whbc:
* ^Subject:.*rebuild
| /home/maven/rebuild.sh

:0
! august.li@wuerth-phoenix.com

rebuild.sh 处理邮件内容。

#! /bin/sh
#
SCRIPT_DIR=/home/maven
LOG_DIR=/home/maven/log

cat >${LOG_DIR}/mail$$.log
cat ${LOG_DIR}/mail$$.log | formail -I "" | (
read line
while [ "$line" = "" ]
do
        if ! read line
        then
                exit 10
        fi
done

if [ `echo $line | grep sylvestrix` ]; then

        exit

elif [ `echo $line | grep auratix$` ]; then

        ${SCRIPT_DIR}/auratix_xdoc.sh >${LOG_DIR}/rebuild$$.log 2>&1

        to=`cat ${LOG_DIR}/mail$$.log | formail -X "From " | cut -d' ' -f2`
        if [ "$to" != "" -a `echo $line | grep auratix` ]; then
                echo `date` - $to >> ${LOG_DIR}/to
                cat ${LOG_DIR}/rebuild$$.log | mail -s "Build Log" $to
        fi

elif [ `echo $line | grep auratix2$` ]; then

        ${SCRIPT_DIR}/auratix_2.sh >${LOG_DIR}/rebuild$$.log 2>&1

        to=`cat ${LOG_DIR}/mail$$.log | formail -X "From " | cut -d' ' -f2`
        if [ "$to" != "" -a `echo $line | grep auratix` ]; then
                echo `date` - $to >> ${LOG_DIR}/to
                cat ${LOG_DIR}/rebuild$$.log | mail -s "Build Log" $to
        fi
else

        exit
fi

)
Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required