All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Monitoring MX Records
Problem
Sometimes we see deals on domain renewals at another registrar or just the transfer price of a domain is cheaper than the renewal price. So we transfer the domain, and if we were using the original registrars DNS it may be some time before we realize that no mail is incoming. I have made this mistake more than once before.
One Possible solution
I wrote a small script and put it into /etc/cron.hourly that will check the first MX record listed for a given domain against an expected value.
The Script
https://pastebin.pl/view/f572cb4c [ The forum wont let me post the code ]
Feedback
Does this look like a good idea? Can you offer any comments or suggestions as to how this can be improved or is it good as it.
Thanks in advance.
Comments
When I try too post the script
Well, I think i found the problem..?
I will take this into consideration.
This sometimes happens when you use your own DNS.
Are the registrars DNS usually more reliable than your own VPS DNS?
Probably... I would highly recommend using Cloudflare though
Here is a bit shorter and more clear dig command for MX:
dig google.com MX +short | sort -u | head -n1 | awk '{print $NF}'
Thanks. I am guessing that -u will sort 1 10 2 20 as 1 2 10 20. Also awk '{print $NF}' is shorter which is good.
Do you think the way I chose to go about this is reasonable?
BTW sort -u broke the script. For example I got the 3rd Google MX record instead of the First. So I will keep sort -n.
sort -u shows unique records as there can be repeating ones. Implement DNSSEC if you care about your domain security https://www.icann.org/resources/pages/dnssec-what-is-it-why-important-2019-03-05-en