1#! /bin/sh 2 3HOSTNAME=$(/bin/hostname) 4 5if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ]; then 6 # If hostname is invalid, and myhostname not existed in main.cf 7 /usr/sbin/postconf -h "myhostname" 2>/dev/null 8 if [ $? -ne 0 ]; then 9 # Set "localhost" to main.cf 10 /usr/sbin/postconf -e "myhostname=localhost" 11 fi 12fi 13 14