3 # Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk>
4 # Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk>
6 # Chancellor Masters and Scholars of the University of Cambridge
7 # Copyright 2010 Tony Finch <fanf@dotat.at>
9 # This is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with userv-utils; if not, see http://www.gnu.org/licenses/.
35 *) files=$subdomain ;;
38 if test -f $files,timings && read lastup charge <$files,timings
40 if [ $now -lt $[ $lastup + $interval_min ] ]; then
41 echo "wait $[ $lastup + $interval_min - $now ]"
42 echo >&2 "must wait at least $interval_min between updates"
45 charge=$[ $charge + $interval_avg - ($now - $lastup) ]
46 if [ $charge -gt $interval_mem ]; then
47 echo "wait $[ $charge - $interval_mem ]"
48 echo >&2 "must wait on average $interval_avg between updates"
51 if [ $charge -lt 0 ]; then charge=0; fi
56 if test -f $files,data
59 diff >/dev/null $files,data $files,new
63 if [ $diff = 0 ]; then echo 'unchanged'; exit 0; fi
64 if [ $diff != 1 ]; then exit 1; fi
67 echo $now $charge >$files,timings.new
68 mv -f $files,timings.new $files,timings
69 mv $files,new $files,data
71 exec /usr/share/userv/dyndns/install $zone