view test.bash @ 74:b7449114ebb0

start coding on new config syntax
author carl
date Sun, 10 Jul 2005 14:19:00 -0700
parents 390ed250c5d2
children 81f1e400e8ab
line wrap: on
line source

#!/bin/bash

############################
## compile and run the test program
##
#g++ -c test.cpp
#if [ $? -ne 0 ]; then
#    echo "compiler errors"
#    exit
#fi
#g++ -o test test.o -pthread
#if [ $? -ne 0 ]; then
#    echo "linker errors"
#    exit
#fi


###########################
# compile the milter
#
rm -f dnsbl.o scanner.o context.o tokenizer.o
g++ -c -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp
if [ $? -ne 0 ]; then
    echo "compiler errors"
    exit
fi
g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread
if [ $? -ne 0 ]; then
    echo "linker errors"
    exit
fi

if [ "$1" == "comp" ]; then
    exit
fi

# build the test.cf file
make test.cf

# start the milter
pid=/var/run/dnsbl.pid
echo start the milter
mkdir -p /var/run/dnsbl
chmod 700 /var/run/dnsbl
chown dnsbl:dnsbl /var/run/dnsbl
mv -f $pid $pid.save
./dnsbl -d -r /var/run/dnsbl/dnsbl.resolver.sock2 -p local:/var/run/dnsbl/dnsbl.sock2
sleep 5
P2=`cat $pid`
mv -f $pid.save $pid
echo started dnsbl milter as process $P2

/usr/lib/sendmail -bd -Ctest.cf -Ldnsbl
sleep 5
P3=`head -1 /var/run/sm-test.pid`
echo started sendmail as process $P3

echo eventually "'"kill -KILL $P2 $P3"'"