1
0
mirror of https://github.com/EV21/dynb.git synced 2026-02-24 21:31:22 +01:00

22 Commits

Author SHA1 Message Date
93c1ed18d0 🐛 fix loop and error handling in case of connection issues 2021-04-23 12:00:35 +02:00
2c23b1de6e 📝 document example of an docker-compose.yml file 2021-04-22 22:30:08 +02:00
f9507929da add Dockerfile 2021-04-22 22:17:49 +02:00
30e77c9722 📝 document loop mode and dig as requirement 2021-04-22 22:10:11 +02:00
bb1d514b50 add loop mode 2021-04-22 21:55:25 +02:00
c02dc68f17 📝 update example of .env in README.md 2021-04-21 13:45:45 +02:00
dcf9f1e7a2 ♻️ refactor: rename environment variables 2021-04-21 13:04:59 +02:00
4d28f55ce9 add support for Duck DNS as DynDNS2 provider 2021-04-04 16:31:42 +02:00
b8565eb38f add support for deSEC as DynDNS2 provider 2021-04-04 11:24:13 +02:00
ab330e9731 add completion
 add man page
2021-04-03 17:35:26 +02:00
262f7c3709 replace getopt with argbash 2021-04-03 14:06:03 +02:00
5210c35400 ♻️ refactor, fix and debug error handling 2021-01-27 17:52:15 +01:00
522a0f99bb ♻️ refactor main code 2021-01-26 22:23:03 +01:00
3bf6b69ae8 add interpretaton of status codes and act accordingly 2021-01-26 21:43:07 +01:00
d139022295 make network interface configurable 2021-01-26 21:43:07 +01:00
8997835903 🐛 fix sourcing of config file
♻️ do some shellcheck fixes
2021-01-26 21:43:07 +01:00
d6dc223794 add DynDNS2 support for dynv6.com 2021-01-26 21:43:07 +01:00
dc12f71d00 📝 add CHANGELOG.md 2021-01-26 21:43:07 +01:00
5ba730cff1 add .gitchangelog.rc 2021-01-26 21:43:07 +01:00
1104cf8505 📝 add example.env 2021-01-26 21:43:07 +01:00
99a446f4c7 📝 write README.md 2021-01-26 21:42:21 +01:00
f056e96e25 add dynb.sh 2021-01-26 21:24:33 +01:00
2 changed files with 34 additions and 5 deletions

View File

@@ -1,6 +1,13 @@
# Changelog
## 0.1.1 (2021-04-23)
### Fix
* :bug: fix loop and error handling in case of connection issues. [Eduard Veit]
## 0.1.0 (2021-04-22)
### New

32
dynb.sh
View File

@@ -65,7 +65,7 @@ _response=
_statusHostname=
_statusUsername=
_statusPassword=
_version=0.1.0
_version=0.1.1
_userAgent="DynB/$_version github.com/EV21/dynb"
_configFile=$HOME/.local/share/dynb/.env
_statusFile=/tmp/dynb.status
@@ -656,18 +656,40 @@ function checkStatus() {
function ipHasChanged() {
if [[ ${1} == 4 ]]; then
remote_ip=$(getRemoteIP 4 $_ipv4_checker)
#TODO: this is doublicated code, refactor this some time
if [[ $? -gt 0 ]]; then
echoerr "IPCheck (getRemoteIP) request failed $remote_ip"
return 0
fi
if [[ $DYNB_UPDATE_METHOD == domrobot ]]; then
dns_ip=$(getDNSIP A)
else
dns_ip=$(dig @${_DNS_checkServer} in a +short "$DYNB_DYN_DOMAIN")
dig_response=$(dig @${_DNS_checkServer} in a +short "$DYNB_DYN_DOMAIN")
#TODO: this is doublicated code, refactor this some time
if [[ $dig_response == ";; connection timed out; no servers could be reached" ]]; then
echoerr "DNS request failed $dig_response"
return 0
fi
dns_ip=$dig_response
fi
fi
if [[ ${1} == 6 ]]; then
remote_ip=$(getRemoteIP 6 $_ipv6_checker)
#TODO: this is doublicated code, refactor this some time
if [[ $? -gt 0 ]]; then
echoerr "IPCheck (getRemoteIP) request failed $remote_ip"
return 0
fi
if [[ $DYNB_UPDATE_METHOD == domrobot ]]; then
dns_ip=$(getDNSIP AAAA)
else
dns_ip=$(dig @${_DNS_checkServer} in aaaa +short "$DYNB_DYN_DOMAIN")
dig_response=$(dig @${_DNS_checkServer} in aaaa +short "$DYNB_DYN_DOMAIN")
#TODO: this is doublicated code, refactor this some time
if [[ $dig_response == ";; connection timed out; no servers could be reached" ]]; then
echoerr "DNS request failed $dig_response"
return 0
fi
dns_ip=$dig_response
fi
fi
@@ -847,7 +869,7 @@ function doUpdates() {
debugMessage "Skip DynDNS2 update, checkStatus fetched previous error."
fi
else
debugMessage "Skip DynDNS2 update, IPs are up to date"
debugMessage "Skip DynDNS2 update, IPs are up to date or there is a connection problem"
fi
fi
}
@@ -882,7 +904,7 @@ function dynb() {
if loopMode; then
while checkStatus
while :
do
doUpdates
sleep $DYNB_INTERVAL