Added support for WAN_IP_COMMAND directive.
This commit is contained in:
parent
0c6fe8291a
commit
18ae8bb993
@ -53,7 +53,6 @@ With `crontab -e` you can add the following line for running the script every 5
|
|||||||
- The code is now structured in functions which makes it more maintainable and modular.
|
- The code is now structured in functions which makes it more maintainable and modular.
|
||||||
- Backwards compatibility should be given.
|
- Backwards compatibility should be given.
|
||||||
- Avoid using awk and get rid of dependency
|
- Avoid using awk and get rid of dependency
|
||||||
- NOTE: The IPCOMMAND directive is not implemented yet
|
|
||||||
|
|
||||||
**2021-12-11**
|
**2021-12-11**
|
||||||
|
|
||||||
|
15
nsupdate.sh
15
nsupdate.sh
@ -105,11 +105,18 @@ get_domain_info () {
|
|||||||
## File name for tempory file to store the XML from API
|
## File name for tempory file to store the XML from API
|
||||||
tmp_file="${domain}_${record_type}_$(date +%s).xml"
|
tmp_file="${domain}_${record_type}_$(date +%s).xml"
|
||||||
|
|
||||||
## Get connection type by record type
|
## Check if WAN_IP_COMMAND is set and use it for retrieving the IP
|
||||||
if [ "${record_type}" = "AAAA" ]; then
|
if [ -z $WAN_IP_COMMAND ]; then
|
||||||
wan_ip="${wan_ip6}"
|
WAN_IP_COMMAND="${IPCOMMAND:-${WAN_IP_COMMAND}}" ## for backwards compatibility
|
||||||
|
wan_ip="${WAN_IP_COMMAND}"
|
||||||
else
|
else
|
||||||
wan_ip="${wan_ip4}"
|
## Otherwise use IP retrieved from web site
|
||||||
|
## Get connection type by record type
|
||||||
|
if [ "${record_type}" = "AAAA" ]; then
|
||||||
|
wan_ip="${wan_ip6}"
|
||||||
|
else
|
||||||
|
wan_ip="${wan_ip4}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chat 3 "Found xmllint. Using curl for retrieving data from INWX API."
|
chat 3 "Found xmllint. Using curl for retrieving data from INWX API."
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
MAIN_DOMAIN="example.com"
|
MAIN_DOMAIN="example.com"
|
||||||
DOMAIN="sub.example.com"
|
DOMAIN="sub.example.com"
|
||||||
|
|
||||||
# The next options must only be set if they differ from the global config in nsupdate.conf
|
# The following options must only be set if they differ from the global config in nsupdate.conf
|
||||||
|
|
||||||
# Login credentials for the INWX API
|
# Login credentials for the INWX API
|
||||||
# These can be left undefined if you specified them globally in the nsupdate.conf
|
# These can be left undefined if you specified them globally in the nsupdate.conf
|
||||||
@ -23,4 +23,8 @@ RECORD_TYPE="AAAA"
|
|||||||
# default TTL setting by INWX is 3600 (1 hour)
|
# default TTL setting by INWX is 3600 (1 hour)
|
||||||
# minimum TTL allowed by INWX is 300 (5 minutes) for regular nameserver record updates
|
# minimum TTL allowed by INWX is 300 (5 minutes) for regular nameserver record updates
|
||||||
# If unspecified, nsupdate uses a TTL of 300
|
# If unspecified, nsupdate uses a TTL of 300
|
||||||
#RECORD_TTL="300"
|
#RECORD_TTL="300"
|
||||||
|
|
||||||
|
# Use a shell command to retrieve the WAN IP (eg. by SSHing to the router and get the IP from the WAN interface)
|
||||||
|
# Otherwise the IP retrieved by website will be used
|
||||||
|
#WAN_IP_COMMAND=$(ssh user@10.0.3.1 ifconfig pppoe1 | grep 'inet ' | cut -d' ' -f2)
|
Loading…
x
Reference in New Issue
Block a user