postfix, auto postmap using inotify

required: inotify-tools

first create this bash script, let’s name it as transport.sh

#!/bin/bash
while true; do
	inotifywait -e modify /etc/postfix/transport
	postmap hash:/etc/postfix/transport
done

make it executable

chmod 755 transport.sh

run the script

./transport.sh > /dev/null 2>&1&

this script will stay on background proccess.

try modify transport file

dd.com smtp:[x.x.x.x]:25
ee.com smtp:[x.x.x.x]:25

save it, and test it

postmap -q ee.com hash:/etc/postfix/transport
smtp:[x.x.x.x]:25

enjoy

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *