renaming
[shutils.git] / nsd / nsd-update
diff --git a/nsd/nsd-update b/nsd/nsd-update
new file mode 100755 (executable)
index 0000000..fb5f6d2
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+watchfile=/tmp/$(hostname).ip
+
+while true; do
+        case $1 in
+                -h|--help)
+                       echo "$0 [--watchfile=$watchfile] <server>"
+                        exit 0
+                        ;;
+               --watchfile)
+                       watchfile=$2
+                       shift
+                       ;;
+                *) break ;;
+        esac
+        shift
+done
+
+server=$1
+pubip=$(/usr/local/bin/printPublicIp)
+
+if ! echo "$pubip" | egrep -q "^([0-9]+\\.)+[0-9]+$" ; then
+       echo "Wrong IP address format"
+       exit 1
+fi
+
+echo "Notify $server that $(hostname) has address ${pubip}."
+
+. $HOME/.profile-sshagent
+ssh $server "echo $pubip > /tmp/euklid.ip"