Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daschr/dnswatch
watch for changes of A/AAAA records
https://github.com/daschr/dnswatch
command-line dns shell shell-scripting
Last synced: 8 days ago
JSON representation
watch for changes of A/AAAA records
- Host: GitHub
- URL: https://github.com/daschr/dnswatch
- Owner: daschr
- License: mit
- Created: 2020-06-25T06:17:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-25T06:56:45.000Z (over 4 years ago)
- Last Synced: 2023-08-24T09:24:05.158Z (over 1 year ago)
- Topics: command-line, dns, shell, shell-scripting
- Language: C
- Homepage:
- Size: 32.2 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dnswatch
Wait for changes of DNS A/AAAA records and run a given command each time.## install
* `make`
* `sudo make install`## usage
`dnswatch [@|T|AAAA] [--] [fqdn] [command] [args]...`The changed records are stored in the envvars `$ADDRESSES` and `$ADDRESS`.
## "But for what is it good for?!?"
Well, I use it for wireguard clients connecting to a peer with a dynamic address.
`dnswatch T30 nonexistent.freemyip.com sh -c 'wg-quick down wg0; wg-quick up wg0'`
or
`dnswatch @208.67.222.222 T120 AAAA nonexistent.freemyip.com restart_wireguard.sh`
## more examples
* `dnswatch golem.de sh -c 'echo "changed to $ADDRESSES!"'` <-- will contact the default name server (1.1.1.1) every 60 seconds, executes the command in case of change
* `dnswatch @8.8.8.8 golem.de sh -c 'echo "changed to $ADDRESSES!"'` <-- will contact google's name server every 60 seconds, executes the command in case of change
* `dnswatch @8.8.8.8 T10 golem.de sh -c 'echo "changed to $ADDRESSES!"'` <-- will contact google's name server every 10 seconds, executes the command in case of change
* `dnswatch @8.8.8.8 T10 AAAA golem.de sh -c 'echo "changed to $ADDRESSES!"'` <-- will contact google's name server every 10 seconds, fetches the AAAA record, executes the command in case of change