45 lines
888 B
Markdown
45 lines
888 B
Markdown
# pb-dydns
|
|
|
|
Script in PHP to update DNS type A records on porkbun.com using their API.
|
|
|
|
This can easily be modified to a different programming or scripting language and domain registrar.
|
|
|
|
## Prerequisites
|
|
|
|
- At least one domain in porkbun.com with DNS type A records already pointing to your dynamic IP address.
|
|
- Access to Porkbun API.
|
|
|
|
## How to use it
|
|
|
|
### from command line
|
|
|
|
```
|
|
$ php /path/to/pb-dydns.php domain_name
|
|
```
|
|
|
|
### as a cron job
|
|
|
|
```
|
|
$ crontab -e
|
|
```
|
|
|
|
Modify this line to fit your needs, and add it as many times as domains you want to automatically update:
|
|
|
|
```
|
|
*/10 * * * * php /path/to/pb-dydns.php domain_name > /dev/null
|
|
```
|
|
|
|
That will run the script every 10 minutes.
|
|
|
|
Then restart cron (I'm not sure if this is necessary):
|
|
|
|
```
|
|
$ sudo systemctl restart cron
|
|
```
|
|
|
|
Entries to `pb-dydns.log` will be added, to view it you can:
|
|
|
|
```
|
|
$ cat /path/to/pb-dydns.log
|
|
```
|