24 lines
427 B
Bash
24 lines
427 B
Bash
|
#!/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
|
||
|
|