From 601b76b675a917ba7419ba20e153f667ae65fc71 Mon Sep 17 00:00:00 2001 From: Talon Date: Tue, 8 Mar 2022 18:53:41 -0700 Subject: [PATCH] wrap it up --- Makefile | 4 +-- README.md | 32 +++++++++++-------- LICENSE => UNLICENSE | 0 .../DynGanDiNS.service | 0 DynGanDiNS.timer => systemd/DynGanDiNS.timer | 0 5 files changed, 20 insertions(+), 16 deletions(-) rename LICENSE => UNLICENSE (100%) rename DynGanDiNS.service => systemd/DynGanDiNS.service (100%) rename DynGanDiNS.timer => systemd/DynGanDiNS.timer (100%) diff --git a/Makefile b/Makefile index 3b307be..1a53a95 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ install: install DynGanDiNS.sh /bin/DynGanDiNS - install --target-directory /usr/lib/systemd/system/ --mode 644 DynGanDiNS.service - install --target-directory /usr/lib/systemd/system/ --mode 644 DynGanDiNS.timer + install --target-directory /usr/lib/systemd/system/ --mode 644 systemd/DynGanDiNS.service + install --target-directory /usr/lib/systemd/system/ --mode 644 systemd/DynGanDiNS.timer install --mode 644 -D Settings.env /etc/sysconfig/DynGanDiNS uninstall: diff --git a/README.md b/README.md index b91d4fa..7466ecd 100644 --- a/README.md +++ b/README.md @@ -8,36 +8,40 @@ Dynamic DNS for gandi.net * `curl` to update the configured domain and record on [Gandi via the API](https://doc.livedns.gandi.net/) * Unless the IP has not changed (compared to previous check at /tmp/DynGanDiNS.ip) -* Bash without the isms. Portability aimed. -* systemd timer included! ## How to use -Acquire an API key from Gandi by visiting your account page and finding the -authorized apps UI to generate one. Then clone this repo locally. Update `Settings.env` with your API key, domain and record name. Then run `make install` (sudo as needed). After installation the environment variables are sourced from `/etc/sysconfig/DynGanDiNS` which will look like this (but hopefully with your info by now, not empty variables): +* Acquire an API key from Gandi by visiting your account page and finding the authorized apps UI to generate one. +* Clone this repo locally. +* Update `Settings.env` with your API key, domain, record name and any optional setting overrides. +* Run `make install` (sudo as needed). + +After installation the environment variables are sourced from `/etc/sysconfig/DynGanDiNS` which will look like this (but hopefully with your info by now, not empty variables): ```sh GDDNS_API_KEY= GDDNS_DOMAIN= GDDNS_RECORD_NAME= ``` -> If not using the systemd timer/service then you'll have to supply the environment variables some other way. Also probably don't bother with `make install` just use `DynGanDiNS.sh` how you please. -Also and optionally `GDDNS_TTL` is available for config and defaults to 3600 as well as `GDDNS_EXTERNAL_IP` which defaults to `https://ipv4.icanhazip.com` +### Optional Settings + +* `GDDNS_EXTERNAL_IP` defaults to `https://ipv4.icanhazip.com` +* `GDDNS_TTL` defaults to 3600 + +Note that `make install` is to wire up `DynGanDiNS.sh` as a systemd service. It's possible you may want to just use the shell file in which case you'll have to supply the environment variables some other way or modify the file directly. ### Timer -By default the timer is configured to run the service every hour. Use `systemctl edit DynGanDiNS.timer` to override `OnCalendar` as desired. - -```sh -# do this after having updated Settings.env and running `make install` -systemctl enable --now DynGanDiNS.timer -``` - If this is the first time setting everything up you may want to run the service right away instead of waiting for the timer. Ensure it worked by checking `journalctl -u DynGanDiNS`. ```sh systemctl start DynGanDiNS ``` -> If you already ran the install then the settings are here: /etc/sysconfig/DynGanDiNS +> After `make install` the settings live here: /etc/sysconfig/DynGanDiNS + +By default the timer is configured to run the service every hour. Use `systemctl edit DynGanDiNS.timer` to override `OnCalendar` as desired. +```sh +systemctl enable --now DynGanDiNS.timer +``` ## Why? diff --git a/LICENSE b/UNLICENSE similarity index 100% rename from LICENSE rename to UNLICENSE diff --git a/DynGanDiNS.service b/systemd/DynGanDiNS.service similarity index 100% rename from DynGanDiNS.service rename to systemd/DynGanDiNS.service diff --git a/DynGanDiNS.timer b/systemd/DynGanDiNS.timer similarity index 100% rename from DynGanDiNS.timer rename to systemd/DynGanDiNS.timer