#!/bin/sh
# So sieht ein Proxy-Eintrag aus (Beispiel):
# proxy="-x proxy.heise.de:8888"

# Ohne Proxy genuegt
proxy=""

# Test-URL von DnyDNS.org
# Gemaes Artikel in c't 12/05 anpassen
url="https://test:test@members.dyndns.org/nic/update?system=dyndns&hostname=test.dyndns.org&myip=$4&wildcard=OFF&mx=NOCHG&backmx=NOCHG&offline=NO"

result=`/usr/bin/curl $proxy -k -s $url`
word1=`echo $result | /usr/bin/awk '{print $1}'`

if [ "$word1" != "good" ]
then
   now=`date +"%d.%m.%y %H:%M:%S"`
   echo "$now DynDNS meldet $result!" >> /var/log/system.log
   x=`/usr/bin/osascript <<EOF
      tell application "System Events"
	beep 2
	activate
	set txt to "DynDNS-Fehler: '$result'"
	display dialog txt buttons {"OK"} default button 1
      end tell
   EOF`
fi

