This python tool helps you to keep the A-Record of your DNS zone up to date. The only thing you have to do is to schedule this script with a cronjob or similar. Have fun! ;-)
- Get the current WAN ip address
- Login to the cloudflare api and get the ip address of the first a-record
- Change it if it's necessary
- send a discord message about the ip state (if it has changed or not)
- Implement several Null-Checks
- Add error msgs
- Logger
- Clone the repo to your system
git clone https://github.com/londi/cloudflare-dns-checker.git
- Credentials
Add your credentials and information at the top in the main.py file
- Install the requirements
pip3 install -r requirements.txt
- Start the program
python3 main.py
Here is an example how you could run the program as a cronjob every noon and midnight.
0 0,12 * * * /usr/bin/python3 /root/dns-checker/cloudflare-dns-checker/main.py
More precisely it means: "At minute 0 past hour 0 and 12.".
Hint: I recommend the following website to easy create time schedule expressions: crontab.guru
To check where python3 is installed, use the "which" command:
which python3
/usr/bin/python3
Also helpful... check which timezone is set on your system (e.g. ubuntu):
# get current datetime
date
# set timezone
tzselect
# set permanent
nano ~/.profile
TZ='Europe/Zurich'; export TZ