Ville Walveranta wrote:
Here's the completed script (the IP/CIDR extract worked perfectly --
thanks Barney!):
---
#!/bin/sh
ORIGINAL=/usr/local/etc/postfix/tables/client_access_maps.cidr
NEW=/tmp/postfix_clients.tmp
dig +short senderdomain.net TXT | grep 'v=spf1' | egrep -o
'ip4:[0-9./]+' | sed 's/^ip4://' | sed 's/$/ OK/' > $NEW
ORIGINAL_CK=`cksum $ORIGINAL | awk '{print $1}'`
NEW_CK=`cksum $NEW | awk '{print $1}'`
if [ -s $NEW ] ; then
if [ $ORIGINAL_CK != $NEW_CK ] ; then
cp -f $NEW $ORIGINAL
postfix reload > /dev/null
fi
fi
rm $NEW
exit 0
---
It works except that the Postfix refresh message
("postfix/postfix-script: refreshing the Postfix mail system") is
displayed despite of the attempt to redirect it to /dev/null? Any
idea how I could hide it?
postfix reload > /dev/null 2>&1
Rod
--