1
0
mirror of https://github.com/EV21/dynb.git synced 2025-12-26 16:39:32 +01:00

1 Commits
0.1.0 ... 0.1.1

Author SHA1 Message Date
84784248c3 fix: 🐛 fix loop and error handling in case of connection issues 2021-11-03 18:09:43 +01:00
2 changed files with 34 additions and 5 deletions

View File

@@ -1,6 +1,13 @@
# Changelog # 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) ## 0.1.0 (2021-04-22)
### New ### New

32
dynb.sh
View File

@@ -65,7 +65,7 @@ _response=
_statusHostname= _statusHostname=
_statusUsername= _statusUsername=
_statusPassword= _statusPassword=
_version=0.1.0 _version=0.1.1
_userAgent="DynB/$_version github.com/EV21/dynb" _userAgent="DynB/$_version github.com/EV21/dynb"
_configFile=$HOME/.local/share/dynb/.env _configFile=$HOME/.local/share/dynb/.env
_statusFile=/tmp/dynb.status _statusFile=/tmp/dynb.status
@@ -656,18 +656,40 @@ function checkStatus() {
function ipHasChanged() { function ipHasChanged() {
if [[ ${1} == 4 ]]; then if [[ ${1} == 4 ]]; then
remote_ip=$(getRemoteIP 4 $_ipv4_checker) 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 if [[ $DYNB_UPDATE_METHOD == domrobot ]]; then
dns_ip=$(getDNSIP A) dns_ip=$(getDNSIP A)
else 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
fi fi
if [[ ${1} == 6 ]]; then if [[ ${1} == 6 ]]; then
remote_ip=$(getRemoteIP 6 $_ipv6_checker) 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 if [[ $DYNB_UPDATE_METHOD == domrobot ]]; then
dns_ip=$(getDNSIP AAAA) dns_ip=$(getDNSIP AAAA)
else 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
fi fi
@@ -847,7 +869,7 @@ function doUpdates() {
debugMessage "Skip DynDNS2 update, checkStatus fetched previous error." debugMessage "Skip DynDNS2 update, checkStatus fetched previous error."
fi fi
else 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
fi fi
} }
@@ -882,7 +904,7 @@ function dynb() {
if loopMode; then if loopMode; then
while checkStatus while :
do do
doUpdates doUpdates
sleep $DYNB_INTERVAL sleep $DYNB_INTERVAL