I created this simple tool to automatically update DNS entries for domains hosted at Linode. Uses Linode API v4 to update domain records to a specified target. It's used in combination with cron
to update IPs after they change.
Download or clone this project. Rename .env.example
file to .env
. Make sure you set the LINODE_PAT
to your Linode personal access token. Don't forget to run composer install
.
Sign into the new Linode Manager. Go to My Profile
and API Tokens
.
Create a new Personal Access Token. Make sure to provide proper access level for Domains
.
Get the token and put it in .env
file.
This script shows a table with all your Linode domains:
php helper-domains.php
E.g.:
Lists all the records from a domain. Requires the domain ID provided as argument: domain_id=123456
.
php helper-records.php domain_id=123456
E.g.:
Updates the target for a specified record. Requires domain ID (domain_id=123456
) and record ID (record_id=9876543
) provided as arguments. Also a target IP (target_ip=1.1.1.1
) argument is optional. If provided sets the record target to the argument value. Otherwise obtains the system's public IP address and uses it as target:
php update-record.php domain_id=123456 record_id=9876543
php update-record.php domain_id=123456 record_id=9876543 target_ip=123.234.211.211
E.g.