Blame tests/p_postfix/20_postfix_mta.sh
|
Christoph Galuschka |
384d96 |
#!/bin/sh
|
|
Christoph Galuschka |
384d96 |
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
t_Log "Running $0 - postfix can accept and deliver local email."
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
MAILSPOOL=/var/spool/mail/root
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
# make shure spool file is empty
|
|
Christoph Galuschka |
384d96 |
cat /dev/null > $MAILSPOOL
|
|
Christoph Galuschka |
384d96 |
ret_val=1
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
# send mail to localhost
|
|
Christoph Galuschka |
a60124 |
echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0"
|
|
Christoph Galuschka |
384d96 |
if [ $? = 0 ]
|
|
Christoph Galuschka |
384d96 |
then
|
|
Christoph Galuschka |
384d96 |
t_Log 'Mail has been queued successfully'
|
|
Christoph Galuschka |
384d96 |
MTA_ACCEPT=0
|
|
Christoph Galuschka |
384d96 |
fi
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
sleep 1
|
|
Christoph Galuschka |
384d96 |
grep -q 't_functional test' $MAILSPOOL
|
|
Christoph Galuschka |
384d96 |
if [ $? = 0 ]
|
|
Christoph Galuschka |
384d96 |
then
|
|
Christoph Galuschka |
384d96 |
t_Log 'previously sent mail is in '$MAILSPOOL
|
|
Christoph Galuschka |
384d96 |
SPOOLFILE=0
|
|
Christoph Galuschka |
384d96 |
fi
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ])
|
|
Christoph Galuschka |
384d96 |
then
|
|
Christoph Galuschka |
384d96 |
ret_val=0
|
|
Christoph Galuschka |
384d96 |
fi
|
|
Christoph Galuschka |
384d96 |
|
|
Christoph Galuschka |
384d96 |
t_CheckExitStatus $ret_val
|
|
Christoph Galuschka |
384d96 |
|