Merge branch 'config-file-check'
This commit is contained in:
commit
4180636f91
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Update nameserver entrys at inwx with the current WAN IP (DynDNS)
|
Update nameserver entrys at inwx with the current WAN IP (DynDNS)
|
||||||
|
|
||||||
nsbackup is a bash script that uses curl and the inwx API to update nameserver entrys at inwx with the current WAN IP. It supports IPv4 and IPv6.
|
nsbackup is a shell script that uses curl and the inwx API to update nameserver entrys at inwx with the current WAN IP. It supports IPv4 and IPv6.
|
||||||
|
|
||||||
Place your config files in the _nsupdate.d_ folder.
|
Place your config files in the _nsupdate.d_ folder.
|
||||||
|
|
||||||
@ -14,6 +14,12 @@ At least one config file needs to exist ending with _.config_. A "sample.config.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
**2015-07-22**
|
||||||
|
|
||||||
|
- Changed the way how the existence of config files is checked
|
||||||
|
- Updated the sample config file to reflect new options from the last updates
|
||||||
|
- The script is reported to work in csh and sh too
|
||||||
|
|
||||||
**2015-06-30**
|
**2015-06-30**
|
||||||
|
|
||||||
- Fixed the check for config files. Can now handle more than one file
|
- Fixed the check for config files. Can now handle more than one file
|
||||||
|
@ -5,9 +5,16 @@ IP_CHECK_SITE="https://ip.dblx.io"
|
|||||||
|
|
||||||
# use drill instead of nslookup for hostname lookup
|
# use drill instead of nslookup for hostname lookup
|
||||||
USE_DRILL="YES"
|
USE_DRILL="YES"
|
||||||
|
|
||||||
|
# Use IPv6 connection
|
||||||
IPV6="NO"
|
IPV6="NO"
|
||||||
|
|
||||||
|
# Update an MX record
|
||||||
MX="NO"
|
MX="NO"
|
||||||
|
|
||||||
|
# Suppress all messages
|
||||||
|
SILENT=NO
|
||||||
|
|
||||||
# Login credentials for the inwx admin interface
|
# Login credentials for the inwx admin interface
|
||||||
INWX_USER="USERNAME"
|
INWX_USER="USERNAME"
|
||||||
INWX_PASS='PASSWORD'
|
INWX_PASS='PASSWORD'
|
||||||
|
19
nsupdate.sh
19
nsupdate.sh
@ -24,23 +24,17 @@
|
|||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
##################
|
# check required tools
|
||||||
# check required #
|
|
||||||
##################
|
|
||||||
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; }
|
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; }
|
||||||
command -v awk >/dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; }
|
command -v awk >/dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; }
|
||||||
command -v drill >/dev/null 2>&1 || command -v nslookup >/dev/null 2>&1 || { echo >&2 "I need drill or nslookup installed. Note: all needed items are listed in the README.md file."; exit 1; }
|
command -v drill >/dev/null 2>&1 || command -v nslookup >/dev/null 2>&1 || { echo >&2 "I need drill or nslookup installed. Note: all needed items are listed in the README.md file."; exit 1; }
|
||||||
##################
|
|
||||||
# check config #
|
|
||||||
##################
|
|
||||||
configfiles=$(shopt -s nullglob dotglob; echo nsupdate.d/*.config)
|
|
||||||
if (( ! ${#configfiles} ));then
|
|
||||||
echo "There does not seem to be any config file available." ; exit 1;
|
|
||||||
fi
|
|
||||||
##################
|
|
||||||
|
|
||||||
LOG=$0.log
|
LOG=$0.log
|
||||||
SILENT=NO
|
SILENT=NO
|
||||||
|
|
||||||
|
# Check if there are any usable config files
|
||||||
|
if ls $(dirname $0)/nsupdate.d/*.config 1> /dev/null 2>&1; then
|
||||||
|
|
||||||
# Loop through configs
|
# Loop through configs
|
||||||
for f in $(dirname $0)/nsupdate.d/*.config
|
for f in $(dirname $0)/nsupdate.d/*.config
|
||||||
do
|
do
|
||||||
@ -137,3 +131,6 @@ do
|
|||||||
unset INWX_USER
|
unset INWX_USER
|
||||||
unset INWX_DOMAIN_ID
|
unset INWX_DOMAIN_ID
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
echo "There does not seem to be any config file available in $(dirname $0)/nsupdate.d/." ; exit 1;
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user