Lines Matching +full:update +full:- +full:interval

13 # leap-seconds file manager/updater
21 LEAPSRC="ftp://time.nist.gov/pub/leap-seconds.list"
25 INTERVAL=10
33 # How to restart NTP - older NTP: service ntpd? try-restart | condrestart
38 TMPFILE="/tmp/leap-seconds.$$.tmp"
57 Verifies and if necessary, updates leap-second definition file
60 -s Specify the URL of the master copy to download
62 -4 Use only IPv4
63 -6 Use only IPv6
64 -p 4|6
66 -d Specify the filename on the local system
68 -e Specify how long before expiration the file is to be refreshed
69 Units are required, e.g. "-e 60 days" Note that larger values
72 -f Specify location of ntp.conf (used to make sure leapfile directive is
75 -F Force update even if current file is OK and not close to expiring.
76 -c Command to restart NTP after installing a new file
77 <none> - ntpd checks file daily
78 -r Specify number of times to retry on get failure
80 -i Specify number of minutes between retries
81 $INTERVAL
82 -l Use syslog for output (Implied if CRONJOB is set)
83 -L Don't use syslog for output
84 -P Specify the syslog facility for logging
86 -t Name of temporary file used in validation
88 -q Only report errors to stdout
89 -v Verbose output
90 -z Specify path for utilities
92 -Z Only use system path
105 -c can also be used to invoke another script to perform administrative
112 For cron-friendly behavior, define CRONJOB=1 in the crontab.
125 if [ "$1" = "--help" ]; then
135 PROTO="-4"
138 PROTO="-6"
141 if [ "$OPTARG" = '4' -o "$OPTARG" = '6' ]; then
142 PREFER="--prefer-family=IPv$OPTARG"
144 echo "Invalid -p $OPTARG" >&2
170 INTERVAL="$OPTARG"
198 echo "$SELF -h for usage" >&2
203 shift $((OPTIND-1))
229 if [ -z "$SYSLOG" -o -z "$LOGGER" ]; then
230 if [ -n "$QUIET" -a \( "$1" = "info" -o "$1" = "notice" -o "$1" = "debug" \) ]; then
233 echo "`echo \"$1\" | tr a-z A-Z`: $2"
239 if [ -n "$CRONJOB" -a \( "$1" != "info" \) -a \( "$1" != "debug" \) ] || [ -n "$VERBOSE" ]; then
240 S="-s"
242 $LOGGER $S -t "$SELF[$$]" -p "$LOGFAC.$1" "$2"
245 # Verify interval
246 INTERVAL=$(( $INTERVAL *1 ))
248 # Validate a leap-seconds file checksum
252 # #$ number : the NTP date of the last update
256 # #h hex hex hex hex hex is the SHA-1 checksum of the data & dates, excluding whitespace w/o leadin…
260 if [ ! -f "$1" ]; then
264 # Remove comments, except those that are markers for last update, expires and hash
266 local RAW="`sed $1 -e'/^\\([0-9]\\|#[\$@h]\)/!d' -e'/^#[\$@h]/!s/#.*\$//g'`"
270 local DATA="`echo \"$RAW\" | sed -e'/^#h/d' -e's/^#[\$@]//g' | tr -d '[:space:]'`"
276 local DSHA="`echo -n \"$DATA\" | shasum | sed -e's/[? *].*$//'`"
281 local FSHA="`echo \"$RAW\" | sed -e'/^#h/!d' -e's/^#h//' -e's/[ ] */ 0x/g'`"
284 if [ -n "$FSHA" -a \( "$FSHA" = "$DSHA" \) ]; then
285 if [ -n "$2" ]; then
290 [ -z "$FSHA" ] && FSHA="(no checksum record found in file)"
298 EXPIRES="`echo \"$RAW\" | sed -e'/^#@/!d' -e's/^#@//' | tr -d '[:space:]'`"
299 EXPIRES="$(($EXPIRES - 2208988800 ))"
301 if [ $EXPIRES -lt `date -u +%s` ]; then
302 … log "notice" "File expired on `date -u -d \"Jan 1, 1970 00:00:00 +0000 + $EXPIRES seconds\"`"
310 if ! [ -f "$NTPCONF" ]; then
317 LEAPFILE="`sed $NTPCONF -e'/^ *leapfile *.*$/!d' -e's/^ *leapfile *//'`"
318 if [ -z "$LEAPFILE" ]; then
322 # Allow placing the file someplace else - testing
324 if [ -n "$1" ]; then
336 if [ -n "$FORCE" ] || ! verifySHA $LEAPFILE "$VERBOSE" || [ $EXPIRES -lt `date -d "NOW + $PREFETCH"…
340 if [ -n "$VERBOSE" ]; then
343 if wget $PROTO $PREFER -o ${TMPFILE}.log $LEAPSRC -O $TMPFILE ; then
345 if [ -n "$VERBOSE" ]; then
353 log "warning" "Downloaded file $TMPFILE rejected -- saved for diagnosis"
355 rm -f ${TMPFILE}.log
358 rm -f ${TMPFILE}.log
363 if [ ! -f $LEAPFILE ]; then
364 log "notice" "$LEAPFILE was missing, creating new copy - check permissions"
369 chmod --reference $REFFILE $TMPFILE
370 chown --reference $REFFILE $TMPFILE
373 chcon --reference $REFFILE $TMPFILE
378 if mv -f $TMPFILE $LEAPFILE ; then
381 log "error" "Install $TMPFILE => $LEAPFILE failed -- saved for diagnosis"
387 if [ -n "$RESTART" ]; then
388 if [ -n "$VERBOSE" ]; then
392 if [ $? -eq 0 ]; then
394 if [ -n "$VERBOSE" -a -n "$R" ]; then
399 if [ -n "$R" ]; then
410 rm -f $TMPFILE
411 if [ $TRY -ge $MAXTRIES ]; then
414 if [ -n "$VERBOSE" ]; then
416 log "info" "Waiting $INTERVAL minutes before retrying..."
418 sleep $(( $INTERVAL * 60))
424 if [ -f ${TMPFILE}.log ]; then
426 rm -f ${TMPFILE}.log $TMPFILE