#!/bin/sh

ip_of_host() {
	host "$1" | perl -ne 'if (/has address (\S+)/) { print "$1\n"; exit; }'
}

for host in amimusa.net; do
	ip=`ip_of_host "$host"`
	if [ -n "$ip" ]; then
		echo "$ip $host"
	fi
done > /etc/postfix/network_table

/usr/sbin/postmap /etc/postfix/network_table
