- python==3.9+
pip install virtualenv
python3 -m venv myenv
- On Windows:
myenv\Scripts\activate
- On macOS and Linux:
source myenv/bin/activate
deactivate
For this purpose you use following commands:
pip install --upgrade pip
pip install -r requirements.txt
pip install --upgrade pip
pip install datetime
pip install requests
pip install python-dotenv
Rename the env -> .env file and add Cloudflare information to .env file:
- CLOUDFLARE_ZONE_ID="your_cloudflare_zone_id"
- CLOUDFLARE_EMAIL="your_cloudflare_email_address"
- CLOUDFLARE_GLOBAL_API_KEY="your_cloudflare_global_api_key"
- DOMAIN_NAME="your_domain_name"
Execute the fetch_record_ids.py
script to get the record ids and names.
Add the record ids and names to the dictionary records = {} and execute the update_record_dns_ip.py
script to update the IPs in the DNS records in Cloudflare.
- Update the path in the
run_python.sh
Bash script. - Make the Bash script executable: Provide execute permissions to the Bash script:
chmod +x /usr/local/bin/run_python.sh
*/1 * * * * /usr/local/bin/run_python.sh
@reboot /usr/local/bin/run_python.sh >> /var/log/run_python.log