Jump to content

Simple shell script to update MX records...

Recommended Posts

Hi I need someone to write me a script that can update some MX records on a cpanel server. This isn't my area of expertise and the guy that usually does this sort of thing for me is currently unavailable.


Here's what I need...



On a cPanel server there is a file that contains a list of local mail domain names, one per line.




Files are listed as follows...





etc, etc


I have set of DNS zone files in /var/named








I need to identify all matching files in /var/named that match the domain names in /etc/localdomains and copy the zone files out to a new directory /root/named


Then - for all files in /root/named I need to replace any instance of mx1.host.net. or mx2.host.net with the domain name corresponding to each file, ending in a period.


e.g. in the filename "mydomain.com.db" the MX record hostname "mx1.host.net." will be replaced with "mydomain.com."


It should do this for all files, using each files own filename before the "db" part, as the replacement for the old mx hostname.


I already have a script that will update the zone serials. I just need the above script writing for me to replace the MX records.


If someone can do this for a reasonable price then please let me know.


Many thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated