Postfix-hostname-to-reverse.../set_myhostname.sh
2021-03-24 01:11:11 +01:00

13 lines
250 B
Bash

#!/bin/sh
IP=$(curl ifconfig.me)
curl_retval=$?
host_answer=$(host "$IP")
rev_dns="${host_answer##* }"
rev_dns="${rev_dns%.}"
echo "Rev. DNS is: $rev_dns"
sed -e "s/^myhostname.*/myhostname = $rev_dns ses/" /etc/postfix/main.cf
echo $curl_retval