Docker + crontab backwards compatibility

This commit is contained in:
timothymiller 2020-08-05 03:40:45 -04:00
parent df6b8a381a
commit de9cf97708
3 changed files with 16 additions and 4 deletions

View File

@ -15,4 +15,4 @@ FROM dependencies AS release
WORKDIR / WORKDIR /
COPY cloudflare-ddns.py . COPY cloudflare-ddns.py .
COPY config.json . COPY config.json .
CMD ["python", "/cloudflare-ddns.py"] CMD ["python", "/cloudflare-ddns.py", "--repeat"]

View File

@ -45,7 +45,17 @@ Alternatively, you can use the traditional API keys by setting appropriate value
## :fax: Hosting multiple domains on the same IP? ## :fax: Hosting multiple domains on the same IP?
You can save yourself some trouble when hosting multiple domains pointing to the same IP address (in the case of Traefik) by defining one A & AAAA record 'ddns.example.com' pointing to the IP of the server that will be updated by this DDNS script. For each subdomain, create a CNAME record pointing to 'ddns.example.com'. Now you don't have to manually modify the script config every time you add a new subdomain to your site! You can save yourself some trouble when hosting multiple domains pointing to the same IP address (in the case of Traefik) by defining one A & AAAA record 'ddns.example.com' pointing to the IP of the server that will be updated by this DDNS script. For each subdomain, create a CNAME record pointing to 'ddns.example.com'. Now you don't have to manually modify the script config every time you add a new subdomain to your site!
## :running: Running ## Deploy to Docker
Create a config.json file with your production credentials and run the build-docker-image script.
```bash
chmod +x ./build-docker-image.sh
./build-docker-image.sh
docker run -d timothymiller/cloudflare_ddns:latest
```
## (Legacy) :running: Running
This script requires Python 3.5+, which comes preinstalled on the latest version of Raspbian. Download/clone this repo and give permission to the project's bash script by running `chmod +x ./start-sync.sh`. Now you can execute `./start-sync.sh`, which will set up a virtualenv, pull in any dependencies, and fire the script. This script requires Python 3.5+, which comes preinstalled on the latest version of Raspbian. Download/clone this repo and give permission to the project's bash script by running `chmod +x ./start-sync.sh`. Now you can execute `./start-sync.sh`, which will set up a virtualenv, pull in any dependencies, and fire the script.

View File

@ -125,6 +125,8 @@ def updateIPs():
print("Checking " + ip["type"] + " records") print("Checking " + ip["type"] + " records")
commitRecord(ip) commitRecord(ip)
if(len(sys.argv) > 1):
if(sys.argv[1] == "--repeat"):
import threading
threading.Thread(target=lambda: every(60*15, updateIPs)).start()
updateIPs() updateIPs()
import threading
threading.Thread(target=lambda: every(60*15, updateIPs)).start()