This script updates the DNS A record to Cloudflare. This means that you'll get a DDNS-like function by using this script.
The needed package are "curl", "jq" and "git".
- For Debian/GNU and Ubuntu-based:
sudo apt install -y curl jq git
- For others, please figure out yourself as I'm not familiar with all OS
Create a DNS A record you want the script to update in the Cloudflare web dashboard.
Change the directory to your desired location then
git clone https://github.com/SamWang8891/cloudflare-ddns-script.git && \
cd cloudflare-ddns-script
Inset the needed information to the config.sh file.
chmod +x update-dns.sh
./update-dns.sh
Run cronjob -e
and add * * * * * bash /path/to/update-dns.sh
to the file. Change the time as desired.