check_dyndns_ip.sh erstellt

This commit is contained in:
Patrick 2019-12-02 22:51:02 +01:00
parent 1bc7e243c0
commit b437b5a160
1 changed files with 23 additions and 0 deletions

23
checks/check_dyndns_ip.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
dyndns_name="da-checka.ddnss.de"
myip="$(curl -s http://whatismyip.akamai.com/)"
dnsip="$(dig $dyndns_name +short)"
#debug
#echo -e "My IP:\t$myip\nDNS IP:\t$dnsip"
if [ "$myip" = "$dnsip" ]
then
echo "OK - My IP = \"$myip\"; DNS IP = \"$dnsip\""
exit 0
elif [ "$myip" != "$dnsip" ]
then
echo "CRITICAL - My IP = \"$myip\"; DNS IP = \"$dnsip\""
exit 2
else
echo "UNKNOWN - Unbekannter Status"
exit 3
fi