38my $LEAPFILE; 39 40# How many times to try to download new file 41my $MAXTRIES=6; 42my $INTERVAL=10; 43 44# Where to find ntp config file 45my $NTPCONF="/etc/ntp.conf"; 46 47# How long (in days) before expiration to get updated file 48my $PREFETCH="60"; 49 50# How to restart NTP - older NTP: service ntpd? try-restart | condrestart 51# Recent NTP checks for new file daily, so there's nothing to do 52my $RESTART=""; 53 54my $EXPIRES; 55my $FORCE = ""; 56 57# Where to put temporary copy before it's validated 58my $TMPFILE="/tmp/leap-seconds.$$.tmp"; 59 60# Syslog facility 61my $LOGFAC="daemon"; 62 63# ########################################### 64 65=item update-leap 66 67Usage: $0 [options] [leapfile] 68 69Verifies and if necessary, updates leap-second definition file 70 71All arguments are optional: Default (or current value) shown: 72 -s Specify the URL of the master copy to download 73 $LEAPSRC 74 -d Specify the filename on the local system 75 $LEAPFILE 76 -e Specify how long (in days) before expiration the file is to be 77 refreshed. Note that larger values imply more frequent refreshes. 78 "$PREFETCH" 79 -f Specify location of ntp.conf (used to make sure leapfile directive is 80 present and to default leapfile) 81 $NTPCONF 82 -F Force update even if current file is OK and not close to expiring. 83 -r Specify number of times to retry on get failure 84 $MAXTRIES 85 -i Specify number of minutes between retries 86 $INTERVAL 87 -l Use syslog for output (Implied if CRONJOB is set) 88 -L Don't use syslog for output 89 -P Specify the syslog facility for logging 90 $LOGFAC 91 -t Name of temporary file used in validation 92 $TMPFILE 93 -q Only report errors to stdout 94 -v Verbose output 95 96The following options are not (yet) implemented in the perl version: 97 -4 Use only IPv4 98 -6 Use only IPv6 99 -c Command to restart NTP after installing a new file 100 <none> - ntpd checks file daily 101 -p 4|6 102 Prefer IPv4 or IPv6 (as specified) addresses, but use either 103 -z Specify path for utilities 104 $PATHLIST 105 -Z Only use system path 106 107$0 will validate the file currently on the local system 108 109Ordinarily, the file is found using the "leapfile" directive in $NTPCONF. 110However, an alternate location can be specified on the command line. 111 112If the file does not exist, is not valid, has expired, or is expiring soon, 113a new copy will be downloaded. If the new copy validates, it is installed and 114NTP is (optionally) restarted. 115 116If the current file is acceptable, no download or restart occurs. 117 118-c can also be used to invoke another script to perform administrative 119functions, e.g. to copy the file to other local systems. 120 121This can be run as a cron job. As the file is rarely updated, and leap 122seconds are announced at least one month in advance (usually longer), it 123need not be run more frequently than about once every three weeks. 124 125For cron-friendly behavior, define CRONJOB=1 in the crontab. 126 127Version $VERSION 128=cut 129 130# Default: Use syslog for logging if running under cron 131 132my $SYSLOG = $CRONJOB; 133 134# Parse options 135 136our(%opt); 137 138GetOptions(\%opt, 139 'c=s', 140 'e:60', 141 'F', 142 'f=s', 143 'i:10', 144 'L', 145 'l', 146 'P=s', 147 'q', 148 'r:6', 149 's=s', 150 't=s', 151 'v' 152 ); 153 154$LOGFAC=$opt{P} if (defined($opt{P})); 155$LEAPSRC=$opt{s} if (defined($opt{s})); 156$PREFETCH=$opt{e} if (defined($opt{e})); 157$NTPCONF=$opt{f} if (defined($opt{f})); 158$FORCE="Y" if (defined($opt{F})); 159$RESTART=$opt{c} if (defined($opt{c})); 160$MAXTRIES=$opt{r} if (defined($opt{r})); 161$INTERVAL=$opt{i} if (defined($opt{i})); 162$TMPFILE=$opt{t} if (defined($opt{t})); 163$SYSLOG="Y" if (defined($opt{l})); 164$SYSLOG="" if (defined($opt{L})); 165$QUIET="Y" if (defined($opt{q})); 166$VERBOSE="Y" if (defined($opt{v})); 167 168# export PATH="$PATHLIST$PATH" 169 170# Handle logging 171 172openlog($0, 'pid', $LOGFAC); 173 174sub logger { 175 my ($priority, $message) = @_; 176 177 # "priority" "message" 178 # 179 # Stdout unless syslog specified or logger isn't available 180 # 181 if ($SYSLOG eq "" or $LOGGER eq "") { 182 if ($QUIET ne "" and ( $priority eq "info" or $priority eq "notice" or $priority eq "debug" ) ) { 183 return 0 184 } 185 printf "%s: $message\n", uc $priority; 186 return 0; 187 } 188 189 # Also log to stdout if cron job && notice or higher 190 if (($CRONJOB ne "" and ($priority ne "info" ) and ($priority ne "debug" )) || ($VERBOSE ne "")) { 191 # Log to stderr as well 192 print STDERR "$0: $priority: $message\n"; 193 } 194 syslog($priority, $message); 195} 196 197# Verify interval 198# INTERVAL=$(( $INTERVAL *1 )) 199 200# Validate a leap-seconds file checksum 201# 202# File format: (full description in files) 203# # marks comments, except: 204# #$ number : the NTP date of the last update 205# #@ number : the NTP date that the file expires 206# Date (seconds since 1900) leaps : leaps is the # of seconds to add for times >= Date 207# Date lines have comments. 208# #h hex hex hex hex hex is the SHA-1 checksum of the data & dates, excluding whitespace w/o leading zeroes 209# 210# Returns: 211# 0 File is valid 212# 1 Invalid Checksum 213# 2 Expired 214 215sub verifySHA { 216 my ($file, $verbose) = @_; 217 218 my $raw = ""; 219 my $data = ""; 220 my $FSHA; 221 222 # Remove comments, except those that are markers for last update, 223 # expires and hash 224 225 unless (open(LF, $file)) { 226 warn "Can't open <$file>: $!\n"; 227 print "Will try and create that file.\n"; 228 return 1; 229 }; 230 while (<LF>) { 231 if (/^#\$/) { 232 $raw .= $_; 233 s/^..//; 234 $data .= $_; 235 } 236 elsif (/^#\@/) { 237 $raw .= $_; 238 s/^..//; 239 $data .= $_; 240 s/\s+//g; 241 $EXPIRES = $_ - 2208988800; 242 } 243 elsif (/^#h\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)/) { 244 chomp; 245 $raw .= $_; 246 $FSHA = sprintf("%08s%08s%08s%08s%08s", $1, $2, $3, $4, $5); 247 } 248 elsif (/^#/) { 249 # ignore it 250 } 251 elsif (/^\d/) { 252 s/#.*$//; 253 $raw .= $_; 254 $data .= $_; 255 } else { 256 chomp; 257 print "Unexpected line: <$_>\n"; 258 } 259 } 260 close LF; 261 262 # Remove all white space 263 $data =~ s/\s//g; 264 265 # Compute the SHA hash of the data, removing the marker and filename 266 # Computed in binary mode, which shouldn't matter since whitespace has been removed 267 268 my $DSHA = sha1_hex($data); 269 270 # Extract the file's hash. Restore any leading zeroes in hash segments. 271 272 if ( ( "$FSHA" ne "" ) && ( $FSHA eq $DSHA ) ) { 273 if ( $verbose ne "" ) { 274 logger("info", "Checksum of $file validated"); 275 } 276 } else { 277 logger("error", "Checksum of $file is invalid:"); 278 $FSHA="(no checksum record found in file)" 279 if ( $FSHA eq ""); 280 logger("error", "EXPECTED: $FSHA"); 281 logger("error", "COMPUTED: $DSHA"); 282 return 1; 283 } 284 285 # Check the expiration date, converting NTP epoch to Unix epoch used by date 286 287 if ( $EXPIRES < time() ) { 288 logger("notice", "File expired on " . gmtime($EXPIRES)); 289 return 2; 290 } 291 return 0; 292} 293 294# Verify ntp.conf 295 296-r $NTPCONF || die "Missing ntp configuration: $NTPCONF\n"; 297 298# Parse ntp.conf for leapfile directive 299 300open(LF, $NTPCONF) || die "Can't open <$NTPCONF>: $!\n"; 301while (<LF>) { 302 chomp;
| 41my $LEAPFILE; 42 43# How many times to try to download new file 44my $MAXTRIES=6; 45my $INTERVAL=10; 46 47# Where to find ntp config file 48my $NTPCONF="/etc/ntp.conf"; 49 50# How long (in days) before expiration to get updated file 51my $PREFETCH="60"; 52 53# How to restart NTP - older NTP: service ntpd? try-restart | condrestart 54# Recent NTP checks for new file daily, so there's nothing to do 55my $RESTART=""; 56 57my $EXPIRES; 58my $FORCE = ""; 59 60# Where to put temporary copy before it's validated 61my $TMPFILE="/tmp/leap-seconds.$$.tmp"; 62 63# Syslog facility 64my $LOGFAC="daemon"; 65 66# ########################################### 67 68=item update-leap 69 70Usage: $0 [options] [leapfile] 71 72Verifies and if necessary, updates leap-second definition file 73 74All arguments are optional: Default (or current value) shown: 75 -s Specify the URL of the master copy to download 76 $LEAPSRC 77 -d Specify the filename on the local system 78 $LEAPFILE 79 -e Specify how long (in days) before expiration the file is to be 80 refreshed. Note that larger values imply more frequent refreshes. 81 "$PREFETCH" 82 -f Specify location of ntp.conf (used to make sure leapfile directive is 83 present and to default leapfile) 84 $NTPCONF 85 -F Force update even if current file is OK and not close to expiring. 86 -r Specify number of times to retry on get failure 87 $MAXTRIES 88 -i Specify number of minutes between retries 89 $INTERVAL 90 -l Use syslog for output (Implied if CRONJOB is set) 91 -L Don't use syslog for output 92 -P Specify the syslog facility for logging 93 $LOGFAC 94 -t Name of temporary file used in validation 95 $TMPFILE 96 -q Only report errors to stdout 97 -v Verbose output 98 99The following options are not (yet) implemented in the perl version: 100 -4 Use only IPv4 101 -6 Use only IPv6 102 -c Command to restart NTP after installing a new file 103 <none> - ntpd checks file daily 104 -p 4|6 105 Prefer IPv4 or IPv6 (as specified) addresses, but use either 106 -z Specify path for utilities 107 $PATHLIST 108 -Z Only use system path 109 110$0 will validate the file currently on the local system 111 112Ordinarily, the file is found using the "leapfile" directive in $NTPCONF. 113However, an alternate location can be specified on the command line. 114 115If the file does not exist, is not valid, has expired, or is expiring soon, 116a new copy will be downloaded. If the new copy validates, it is installed and 117NTP is (optionally) restarted. 118 119If the current file is acceptable, no download or restart occurs. 120 121-c can also be used to invoke another script to perform administrative 122functions, e.g. to copy the file to other local systems. 123 124This can be run as a cron job. As the file is rarely updated, and leap 125seconds are announced at least one month in advance (usually longer), it 126need not be run more frequently than about once every three weeks. 127 128For cron-friendly behavior, define CRONJOB=1 in the crontab. 129 130Version $VERSION 131=cut 132 133# Default: Use syslog for logging if running under cron 134 135my $SYSLOG = $CRONJOB; 136 137# Parse options 138 139our(%opt); 140 141GetOptions(\%opt, 142 'c=s', 143 'e:60', 144 'F', 145 'f=s', 146 'i:10', 147 'L', 148 'l', 149 'P=s', 150 'q', 151 'r:6', 152 's=s', 153 't=s', 154 'v' 155 ); 156 157$LOGFAC=$opt{P} if (defined($opt{P})); 158$LEAPSRC=$opt{s} if (defined($opt{s})); 159$PREFETCH=$opt{e} if (defined($opt{e})); 160$NTPCONF=$opt{f} if (defined($opt{f})); 161$FORCE="Y" if (defined($opt{F})); 162$RESTART=$opt{c} if (defined($opt{c})); 163$MAXTRIES=$opt{r} if (defined($opt{r})); 164$INTERVAL=$opt{i} if (defined($opt{i})); 165$TMPFILE=$opt{t} if (defined($opt{t})); 166$SYSLOG="Y" if (defined($opt{l})); 167$SYSLOG="" if (defined($opt{L})); 168$QUIET="Y" if (defined($opt{q})); 169$VERBOSE="Y" if (defined($opt{v})); 170 171# export PATH="$PATHLIST$PATH" 172 173# Handle logging 174 175openlog($0, 'pid', $LOGFAC); 176 177sub logger { 178 my ($priority, $message) = @_; 179 180 # "priority" "message" 181 # 182 # Stdout unless syslog specified or logger isn't available 183 # 184 if ($SYSLOG eq "" or $LOGGER eq "") { 185 if ($QUIET ne "" and ( $priority eq "info" or $priority eq "notice" or $priority eq "debug" ) ) { 186 return 0 187 } 188 printf "%s: $message\n", uc $priority; 189 return 0; 190 } 191 192 # Also log to stdout if cron job && notice or higher 193 if (($CRONJOB ne "" and ($priority ne "info" ) and ($priority ne "debug" )) || ($VERBOSE ne "")) { 194 # Log to stderr as well 195 print STDERR "$0: $priority: $message\n"; 196 } 197 syslog($priority, $message); 198} 199 200# Verify interval 201# INTERVAL=$(( $INTERVAL *1 )) 202 203# Validate a leap-seconds file checksum 204# 205# File format: (full description in files) 206# # marks comments, except: 207# #$ number : the NTP date of the last update 208# #@ number : the NTP date that the file expires 209# Date (seconds since 1900) leaps : leaps is the # of seconds to add for times >= Date 210# Date lines have comments. 211# #h hex hex hex hex hex is the SHA-1 checksum of the data & dates, excluding whitespace w/o leading zeroes 212# 213# Returns: 214# 0 File is valid 215# 1 Invalid Checksum 216# 2 Expired 217 218sub verifySHA { 219 my ($file, $verbose) = @_; 220 221 my $raw = ""; 222 my $data = ""; 223 my $FSHA; 224 225 # Remove comments, except those that are markers for last update, 226 # expires and hash 227 228 unless (open(LF, $file)) { 229 warn "Can't open <$file>: $!\n"; 230 print "Will try and create that file.\n"; 231 return 1; 232 }; 233 while (<LF>) { 234 if (/^#\$/) { 235 $raw .= $_; 236 s/^..//; 237 $data .= $_; 238 } 239 elsif (/^#\@/) { 240 $raw .= $_; 241 s/^..//; 242 $data .= $_; 243 s/\s+//g; 244 $EXPIRES = $_ - 2208988800; 245 } 246 elsif (/^#h\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)\s+([[:xdigit:]]+)/) { 247 chomp; 248 $raw .= $_; 249 $FSHA = sprintf("%08s%08s%08s%08s%08s", $1, $2, $3, $4, $5); 250 } 251 elsif (/^#/) { 252 # ignore it 253 } 254 elsif (/^\d/) { 255 s/#.*$//; 256 $raw .= $_; 257 $data .= $_; 258 } else { 259 chomp; 260 print "Unexpected line: <$_>\n"; 261 } 262 } 263 close LF; 264 265 # Remove all white space 266 $data =~ s/\s//g; 267 268 # Compute the SHA hash of the data, removing the marker and filename 269 # Computed in binary mode, which shouldn't matter since whitespace has been removed 270 271 my $DSHA = sha1_hex($data); 272 273 # Extract the file's hash. Restore any leading zeroes in hash segments. 274 275 if ( ( "$FSHA" ne "" ) && ( $FSHA eq $DSHA ) ) { 276 if ( $verbose ne "" ) { 277 logger("info", "Checksum of $file validated"); 278 } 279 } else { 280 logger("error", "Checksum of $file is invalid:"); 281 $FSHA="(no checksum record found in file)" 282 if ( $FSHA eq ""); 283 logger("error", "EXPECTED: $FSHA"); 284 logger("error", "COMPUTED: $DSHA"); 285 return 1; 286 } 287 288 # Check the expiration date, converting NTP epoch to Unix epoch used by date 289 290 if ( $EXPIRES < time() ) { 291 logger("notice", "File expired on " . gmtime($EXPIRES)); 292 return 2; 293 } 294 return 0; 295} 296 297# Verify ntp.conf 298 299-r $NTPCONF || die "Missing ntp configuration: $NTPCONF\n"; 300 301# Parse ntp.conf for leapfile directive 302 303open(LF, $NTPCONF) || die "Can't open <$NTPCONF>: $!\n"; 304while (<LF>) { 305 chomp;
|
304 $LEAPFILE = $1; 305 } 306} 307close LF; 308 309-s $LEAPFILE || warn "$NTPCONF specifies $LEAPFILE as a leapfile, which is empty.\n"; 310 311# Allow placing the file someplace else - testing 312 313if ( defined $ARGV[0] ) { 314 if ( $ARGV[0] ne $LEAPFILE ) { 315 logger("notice", "Requested install to $ARGV[0], but $NTPCONF specifies $LEAPFILE"); 316 } 317 $LEAPFILE = $ARGV[0]; 318} 319 320# Verify the current file 321# If it is missing, doesn't validate or expired 322# Or is expiring soon 323# Download a new one 324 325if ( $FORCE ne "" || verifySHA($LEAPFILE, $VERBOSE) || ( $EXPIRES lt ( $PREFETCH * 86400 + time() ) )) { 326 my $TRY = 0; 327 my $ff = File::Fetch->new(uri => $LEAPSRC) || die "Fetch failed.\n"; 328 while (1) { 329 ++$TRY; 330 logger("info", "Attempting download from $LEAPSRC, try $TRY..") 331 if ($VERBOSE ne ""); 332 my $where = $ff->fetch( to => '/tmp' ); 333 334 if ($where) { 335 logger("info", "Download of $LEAPSRC succeeded"); 336 337 if ( verifySHA($where, $VERBOSE )) { 338 # There is no point in retrying, as the file on the 339 # server is almost certainly corrupt. 340 341 logger("warning", "Downloaded file $where rejected -- saved for diagnosis"); 342 exit 1; 343 } 344 345 # While the shell script version will set correct permissions 346 # on temporary file, for the perl version that's harder, so 347 # for now at least one should run this script as the 348 # appropriate user. 349 350 # REFFILE="$LEAPFILE" 351 # if [ ! -f $LEAPFILE ]; then 352 # logger "notice" "$LEAPFILE was missing, creating new copy - check permissions" 353 # touch $LEAPFILE 354 # # Can't copy permissions from old file, copy from NTPCONF instead 355 # REFFILE="$NTPCONF" 356 # fi 357 # chmod --reference $REFFILE $TMPFILE 358 # chown --reference $REFFILE $TMPFILE 359 # ( which selinuxenabled && selinuxenabled && which chcon ) >/dev/null 2>&1 360 # if [ $? == 0 ] ; then 361 # chcon --reference $REFFILE $TMPFILE 362 # fi 363 364 # Replace current file with validated new one 365 366 if ( move $where, $LEAPFILE ) { 367 logger("notice", "Installed new $LEAPFILE from $LEAPSRC"); 368 } else { 369 logger("error", "Install $where => $LEAPFILE failed -- saved for diagnosis: $!"); 370 exit 1; 371 } 372 373 # Restart NTP (or whatever else is specified) 374 375 if ( $RESTART ne "" ) { 376 if ( $VERBOSE ne "" ) { 377 logger("info", "Attempting restart action: $RESTART"); 378 } 379 380# XXX 381 #R="$( 2>&1 $RESTART )" 382 #if [ $? -eq 0 ]; then 383 # logger "notice" "Restart action succeeded" 384 # if [ -n "$VERBOSE" -a -n "$R" ]; then 385 # logger "info" "$R" 386 # fi 387 #else 388 # logger "error" "Restart action failed" 389 # if [ -n "$R" ]; then 390 # logger "error" "$R" 391 # fi 392 # exit 2 393 #fi 394 } 395 exit 0; 396 } 397 398 # Failed to download. See about trying again 399 400 # rm -f $TMPFILE 401 if ( $TRY ge $MAXTRIES ) { 402 last; 403 } 404 if ( $VERBOSE ne "" ) { 405 logger("info", "Waiting $INTERVAL minutes before retrying..."); 406 } 407 sleep $INTERVAL * 60 ; 408 } 409 410 # Failed and out of retries 411 412 logger("warning", "Download from $LEAPSRC failed after $TRY attempts"); 413 exit 1; 414} 415 416print "FORCE is <$FORCE>\n"; 417print "verifySHA is " . verifySHA($LEAPFILE, "") . "\n"; 418print "EXPIRES <$EXPIRES> vs ". ( $PREFETCH * 86400 + time() ) . "\n"; 419 420logger("info", "Not time to replace $LEAPFILE"); 421 422exit 0; 423 424# EOF
| 307 $LEAPFILE = $1; 308 } 309} 310close LF; 311 312-s $LEAPFILE || warn "$NTPCONF specifies $LEAPFILE as a leapfile, which is empty.\n"; 313 314# Allow placing the file someplace else - testing 315 316if ( defined $ARGV[0] ) { 317 if ( $ARGV[0] ne $LEAPFILE ) { 318 logger("notice", "Requested install to $ARGV[0], but $NTPCONF specifies $LEAPFILE"); 319 } 320 $LEAPFILE = $ARGV[0]; 321} 322 323# Verify the current file 324# If it is missing, doesn't validate or expired 325# Or is expiring soon 326# Download a new one 327 328if ( $FORCE ne "" || verifySHA($LEAPFILE, $VERBOSE) || ( $EXPIRES lt ( $PREFETCH * 86400 + time() ) )) { 329 my $TRY = 0; 330 my $ff = File::Fetch->new(uri => $LEAPSRC) || die "Fetch failed.\n"; 331 while (1) { 332 ++$TRY; 333 logger("info", "Attempting download from $LEAPSRC, try $TRY..") 334 if ($VERBOSE ne ""); 335 my $where = $ff->fetch( to => '/tmp' ); 336 337 if ($where) { 338 logger("info", "Download of $LEAPSRC succeeded"); 339 340 if ( verifySHA($where, $VERBOSE )) { 341 # There is no point in retrying, as the file on the 342 # server is almost certainly corrupt. 343 344 logger("warning", "Downloaded file $where rejected -- saved for diagnosis"); 345 exit 1; 346 } 347 348 # While the shell script version will set correct permissions 349 # on temporary file, for the perl version that's harder, so 350 # for now at least one should run this script as the 351 # appropriate user. 352 353 # REFFILE="$LEAPFILE" 354 # if [ ! -f $LEAPFILE ]; then 355 # logger "notice" "$LEAPFILE was missing, creating new copy - check permissions" 356 # touch $LEAPFILE 357 # # Can't copy permissions from old file, copy from NTPCONF instead 358 # REFFILE="$NTPCONF" 359 # fi 360 # chmod --reference $REFFILE $TMPFILE 361 # chown --reference $REFFILE $TMPFILE 362 # ( which selinuxenabled && selinuxenabled && which chcon ) >/dev/null 2>&1 363 # if [ $? == 0 ] ; then 364 # chcon --reference $REFFILE $TMPFILE 365 # fi 366 367 # Replace current file with validated new one 368 369 if ( move $where, $LEAPFILE ) { 370 logger("notice", "Installed new $LEAPFILE from $LEAPSRC"); 371 } else { 372 logger("error", "Install $where => $LEAPFILE failed -- saved for diagnosis: $!"); 373 exit 1; 374 } 375 376 # Restart NTP (or whatever else is specified) 377 378 if ( $RESTART ne "" ) { 379 if ( $VERBOSE ne "" ) { 380 logger("info", "Attempting restart action: $RESTART"); 381 } 382 383# XXX 384 #R="$( 2>&1 $RESTART )" 385 #if [ $? -eq 0 ]; then 386 # logger "notice" "Restart action succeeded" 387 # if [ -n "$VERBOSE" -a -n "$R" ]; then 388 # logger "info" "$R" 389 # fi 390 #else 391 # logger "error" "Restart action failed" 392 # if [ -n "$R" ]; then 393 # logger "error" "$R" 394 # fi 395 # exit 2 396 #fi 397 } 398 exit 0; 399 } 400 401 # Failed to download. See about trying again 402 403 # rm -f $TMPFILE 404 if ( $TRY ge $MAXTRIES ) { 405 last; 406 } 407 if ( $VERBOSE ne "" ) { 408 logger("info", "Waiting $INTERVAL minutes before retrying..."); 409 } 410 sleep $INTERVAL * 60 ; 411 } 412 413 # Failed and out of retries 414 415 logger("warning", "Download from $LEAPSRC failed after $TRY attempts"); 416 exit 1; 417} 418 419print "FORCE is <$FORCE>\n"; 420print "verifySHA is " . verifySHA($LEAPFILE, "") . "\n"; 421print "EXPIRES <$EXPIRES> vs ". ( $PREFETCH * 86400 + time() ) . "\n"; 422 423logger("info", "Not time to replace $LEAPFILE"); 424 425exit 0; 426 427# EOF
|