From 080de8eb4539abd0eca04c54a02c0109ca8e3ffc Mon Sep 17 00:00:00 2001 From: The_Lie Date: Wed, 24 Mar 2021 01:11:11 +0100 Subject: [PATCH] Added the actual script. --- set_myhostname.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 set_myhostname.sh diff --git a/set_myhostname.sh b/set_myhostname.sh new file mode 100644 index 0000000..a88dad5 --- /dev/null +++ b/set_myhostname.sh @@ -0,0 +1,13 @@ +#!/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