editdns.pl
Editdns.pl is a Perl script that lets you add and delete DNS records for your domains hosted at EditDNS.net from the command line. You can use it to automatically set up DNS records for dynamic IP address connections (in those cases when DynDNS records are not good enough).
Usage
Before using the script, open it in a text editor and enter your
EditDNS e-mail address and password as $EMAIL
and $PASSWORD.
The script reads a sequence of commands from its standard input. Three commands are recognized:
Add-Record |
add a new DNS record with the specified set of fields |
Delete-Record |
delete an existing record that matches the specified criteria |
Delete-All-Records |
delete all existing records that match the specified criteria |
Command parameters are entered as field name, followed by a colon,
then the value enclosed in double quotes (Name:"Value").
Here's an example of an Add-Record command:
Add-Record Name:"www.example.com." Type:"A" AUX:"1" TTL:"86400" Data:"12.34.56.78"
This command adds a new A record named
"www.example.com.", with an IP address of
12.34.56.78. When adding a record, you need to enter all
the required parameters, ie. name, record type, AUX, TTL, and data.
The Delete-Record command has similar syntax, but in
this case the provided parameters are used to locate the existing DNS
record that will be deleted. It's not necessary to enter all the
parameters, you can just supply one, eg.:
Delete the record named "mail.example.com.":
Delete-Record Name:"mail.example.com."
If more than one parameter is provided, the command looks for the first record that matches ALL the parameters (as if there was a logical AND), eg.:
Delete the MX record for example.com:
Delete-Record Name:"example.com." Type:"MX"
Additionally, you can use regular expressions with
Delete-Record. To use a regular expression, enclose it
in double quotes and put a tilde (~) character in front
of it, eg.:
Delete the example.com A record whose data starts with
"192.168":
Delete-Record Name:"example.com." Type:"A" Data:~"^192\.168"
You can also do negative regular expression matching. Precede the
tilde character with a bang (!), eg.:
Delete the example.com MX record whose data doesn't start with
"mail.":
Delete-Record Name:"example.com." Type:"MX" Data:!~"^mail\."
The Delete-All-Records command works the same way as
Delete-Record, but, as the name implies, it deletes all
the records that match the given criteria.
The script determines the domain that the record belongs to based on
the provided "Name" parameter, but you can enter the
domain name explicitly using the "Domain" parameter,
eg.:
Delete all CNAME records for the example.com
domain:
Delete-All-Records Domain:"example.com." Type:"CNAME"
If you're using a regular expression match for the
"Name" parameter, you MUST supply the domain name
explicitly, eg.:
Delete a record that starts with "www":
Delete-Record Domain:"example.com." Name:~"^www"