cpanel-dnsupdater.pl --host home --domain domain.tld --cpanel_user cptest --cpanel_pass 12345 --cpanel_domain cptest.tld --check_host 184.108.40.206
This script is useful for updating the IP address of an A record on a cPanel hosted domain with either a supplied IP, or a detected IP. This allows you to use your own cPanel domain for dynamic DNS instead of having to use a third party DNS service.
If your specify email address parameters, then script output is emailed to you, otherwise all output is printed to STDOUT.
--host Host name to update in the domain's zonefile. eg. 'www'
--domain Name of the domain to update
--cpanel_user cPanel account login name
--cpanel_pass cPanel account password
--cpanel_domain cPanel account domain name
--check_host IP address of host to check for connectivity. eg. 220.127.116.11 or your DNS resolver
Using a Config File (~/.cpaneldyndns)
--ip IP address to update the A record with. This defaults to the detected external IP.
--email_auth_user Email address for SMTP Auth
--email_auth_pass Password for SMTP Auth (use \ to escape characters)
--email_addr Email address to send successful/error report to (defaults to email_auth_user)
--outbound_server Server to send mail through
--helo Change the HELO that is sent to the outbound server, this setting defaults to the current hostname
--config_file Specify the location of a configuration file (defaults to ~/.cpaneldyndns)
Instead of passing options on the command line, a configuration file can be used.
Any options specified on the command line will be overriden by the configuration file options.
The file takes the format of 'option=value', eg:
The default location of the file is in the home directory of the current user and the default filename is '.cpaneldyndns'
Exits with 1 if there was any issue updating the record, 255 if the end of script was reached in error, and 0 if IP was either changed, or the detected IP matches the given IP.
LICENSE AND COPYRIGHT
Paul Trost <email@example.com>
Original code by Stefan Gofferje - http://stefan.gofferje.net/
Copyright 2012, 2013, 2014, 2015.
This script is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2, or at your option any later version.