]> git.sthu.org Git - shutils.git/blob - nsd/nsd-update
gitconfig: Update
[shutils.git] / nsd / nsd-update
1 #!/bin/sh
2
3 watchfile=/tmp/$(hostname).ip
4
5 while true; do
6 case $1 in
7 -h|--help)
8 echo "$0 [--watchfile=$watchfile] <server>"
9 exit 0
10 ;;
11 --watchfile)
12 watchfile=$2
13 shift
14 ;;
15 *) break ;;
16 esac
17 shift
18 done
19
20 server=$1
21 pubip=$(/usr/local/bin/printPublicIp)
22
23 if ! echo "$pubip" | egrep -q "^([0-9]+\\.)+[0-9]+$" ; then
24 echo "Wrong IP address format"
25 exit 1
26 fi
27
28 echo "Notify $server that $(hostname) has address ${pubip}."
29
30 . $HOME/.profile-sshagent
31 ssh $server "echo $pubip > /tmp/euklid.ip"