Document repeat option

This commit is contained in:
Kaan Barmore-Genç 2022-12-18 01:24:22 -05:00
parent ec8f12880e
commit d32cae06cd
Signed by: kaan
GPG Key ID: B2E280771CD62FCF
2 changed files with 37 additions and 4 deletions

View File

@ -10,8 +10,8 @@ this creates a dynamic DNS system.
If you want to host web services but you don't have a static IP address, this
tool will allow you to keep your domains pointed at the right IP address. This
program can update both IPv4 and IPv6 addresses for one or more domains and
subdomains. It's a one-shot tool that's meant to be managed with a systemd timer
or cron.
subdomains. It can be used as a one-shot tool managed with a systemd timer
or cron, or a long-running process that reschedules itself.
## Usage
@ -67,6 +67,34 @@ build it from source and you have a working rust install, you can use `cargo ins
## Automation
### By running as a background process
`gandi-live-dns` can run as a daemon, a background process, periodically perform
the IP address updates. To do so, add the `--repeat=<delay-in-seconds>` command
line option. When given, this tool will not quit after updating your IP address
and instead will continue to perform periodic updates.
If you are using Docker, you can add this option when starting it:
```bash
# This will update your IP now, then repeat every 24 hours
docker run --rm -it -v $(pwd)/gandi.toml:/gandi.toml:ro seriousbug/gandi-live-dns-rust:latest --repeat=86400
```
Or with a `docker-compose.yml` file, add it in the arguments:
```yml
gandi-live-dns:
image: seriousbug/gandi-live-dns-rust:latest
restart: always
volumes:
- ./gandi.toml:/gandi.toml:ro
# Repeat the update every day
command: --repeat=86400
```
### With a Systemd timer
The `Packaging` folder contains a Systemd service and timer, which you can use
to automatically run this tool. By default it will update the IP addresses after
every boot up, and at least once a day. You can adjust the timer to speed this

View File

@ -17,9 +17,14 @@ pub struct Opts {
/// If enabled, any IPv6 (AAAA) records in the configuration file are ignored.
#[clap(action, long)]
pub skip_ipv6: bool,
/// Repeat after specified delay
/// Repeat after specified delay, in seconds.
///
/// If enabled waits for the given delay between updating DNS records
/// If enabled, this will continue to run and perform the updates
/// periodically. The first update will happen immediately, and later
/// updates will be delayed by this many seconds.
///
/// This process will not fork, so you may need to use something like
/// `nohup` to keep it running in the background.
#[clap(long)]
pub repeat: Option<u64>,
}