Best in show gets better.

Regarding an earlier post, I made some changes to my NetworkManager dispatcher script. The problem with the original was that it reset defer_transports when any interface went down, without regard for redundancy. Since I use my laptop in my home office, it’s often plugged into a wired network. When I disconnect to go somewhere else in the house (on the rare occasions I get the chance to wander), my wireless takes over courtesy of NetworkManager, of course. So there’s no need to change the Postfix server configuration if I still have a default route in place.

This script works better:

#!/bin/sh
 
if [ "$2" == "down" ]; then
  ( [ -z "`ip route show 0.0.0.0/0`" ] && \
    usr/sbin/postconf -e 'defer_transports = smtp' \
    && /sbin/service postfix reload ) || :
elif [ "$2" == "up" ]; then
  ( /usr/sbin/postconf -e 'defer_transports =' \
    && /sbin/service postfix reload && \
    /sbin/service postfix flush ) || :
fi

Thus far, results have been outstanding. I made this change a few days back but hadn’t had the opportunity to blog about it until now.