wrap it up

This commit is contained in:
Talon 2022-03-08 18:53:41 -07:00
parent ace83edacb
commit 601b76b675
5 changed files with 20 additions and 16 deletions

View file

@ -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:

View file

@ -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?

View file