xref: /freebsd/contrib/ntp/scripts/update-leap/update-leap.html (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6<title>update-leap User&rsquo;s Manual</title>
7
8<meta name="description" content="update-leap User&rsquo;s Manual">
9<meta name="keywords" content="update-leap User&rsquo;s Manual">
10<meta name="resource-type" content="document">
11<meta name="distribution" content="global">
12<meta name="Generator" content="makeinfo">
13<link href="#Top" rel="start" title="Top">
14<link href="dir.html#Top" rel="up" title="(dir)">
15<style type="text/css">
16<!--
17a.summary-letter {text-decoration: none}
18blockquote.indentedblock {margin-right: 0em}
19blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
20blockquote.smallquotation {font-size: smaller}
21div.display {margin-left: 3.2em}
22div.example {margin-left: 3.2em}
23div.lisp {margin-left: 3.2em}
24div.smalldisplay {margin-left: 3.2em}
25div.smallexample {margin-left: 3.2em}
26div.smalllisp {margin-left: 3.2em}
27kbd {font-style: oblique}
28pre.display {font-family: inherit}
29pre.format {font-family: inherit}
30pre.menu-comment {font-family: serif}
31pre.menu-preformatted {font-family: serif}
32pre.smalldisplay {font-family: inherit; font-size: smaller}
33pre.smallexample {font-size: smaller}
34pre.smallformat {font-family: inherit; font-size: smaller}
35pre.smalllisp {font-size: smaller}
36span.nolinebreak {white-space: nowrap}
37span.roman {font-family: initial; font-weight: normal}
38span.sansserif {font-family: sans-serif; font-weight: normal}
39ul.no-bullet {list-style: none}
40-->
41</style>
42
43
44</head>
45
46<body lang="en">
47<h1 class="settitle" align="center">update-leap User&rsquo;s Manual</h1>
48
49
50
51
52
53<a name="Top"></a>
54<div class="header">
55<p>
56Previous: <a href="dir.html#Top" accesskey="p" rel="prev">(dir)</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; </p>
57</div>
58<h1 class="node-heading">Top</h1>
59
60<p>This document describes the use of the NTP Project&rsquo;s <code>update-leap</code> program.
61</p>
62<p>This document applies to version 4.2.8p15 of <code>update-leap</code>.
63</p>
64<a name="SEC_Overview"></a>
65<h2 class="shortcontents-heading">Short Table of Contents</h2>
66
67<div class="shortcontents">
68<li><a name="stoc-Invoking-update_002dleap" href="#toc-Invoking-update_002dleap">1 Invoking update-leap</a></li>
69
70</div>
71
72
73<table class="menu" border="0" cellspacing="0">
74<tr><td align="left" valign="top">&bull; update-leap Description:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Description
75</td></tr>
76<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-Invocation" accesskey="2">update-leap Invocation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Invoking update-leap
77</td></tr>
78</table>
79
80<hr>
81<a name="update_002dleap-Invocation"></a>
82<div class="header">
83<p>
84Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; </p>
85</div>
86<a name="Invoking-update_002dleap"></a>
87<h3 class="section">1 Invoking update-leap</h3>
88<a name="index-update_002dleap"></a>
89<a name="index-leap_002dseconds-file-manager_002fupdater"></a>
90
91
92
93<p><code>update-leap</code>
94will validate the file currently on the local system
95and if necessary, updates leap-second definition file.
96</p>
97<p>Ordinarily, the file is found using the &quot;leapfile&quot; directive in
98<code>ntp.conf(5)</code>.
99However, an alternate location can be specified on the command line.
100</p>
101<p>If the file does not exist, is not valid, has expired, or is expiring soon,
102a new copy will be downloaded.  If the new copy validates, it is installed and
103NTP is (optionally) restarted.
104</p>
105<p>If the current file is acceptable, no download or restart occurs.
106</p>
107<p>-c can also be used to invoke another script to perform administrative
108functions, e.g. to copy the file to other local systems.
109.PP
110This can be run as a cron job.  As the file is rarely updated, and leap
111seconds are announced at least one month in advance (usually longer), it
112need not be run more frequently than about once every three weeks.
113.PP
114For cron-friendly behavior, define CRONJOB=1 in the crontab.
115.PP
116This script depends on$REQUIREDCMDS
117</p>
118<p>This section was generated by <strong>AutoGen</strong>,
119using the <code>agtexi-cmd</code> template and the option descriptions for the <code>update-leap</code> program.
120</p>
121<table class="menu" border="0" cellspacing="0">
122<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-usage" accesskey="1">update-leap usage</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">update-leap help/usage (<samp>--help</samp>)
123</td></tr>
124<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-source_002durl" accesskey="2">update-leap source-url</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">source-url option (-s)
125</td></tr>
126<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-ipv4" accesskey="3">update-leap ipv4</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">ipv4 option (-4)
127</td></tr>
128<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-destination" accesskey="4">update-leap destination</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">destination option (-d)
129</td></tr>
130<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-expiration" accesskey="5">update-leap expiration</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">expiration option (-e)
131</td></tr>
132<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-ntp_002dconf_002dfile" accesskey="6">update-leap ntp-conf-file</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">ntp-conf-file option (-f)
133</td></tr>
134<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-force_002dupdate" accesskey="7">update-leap force-update</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">force-update option (-F)
135</td></tr>
136<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-exit-status" accesskey="8">update-leap exit status</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">exit status
137</td></tr>
138<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-Usage" accesskey="9">update-leap Usage</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Usage
139</td></tr>
140<tr><td align="left" valign="top">&bull; <a href="#update_002dleap-Authors">update-leap Authors</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Authors
141</td></tr>
142</table>
143
144<hr>
145<a name="update_002dleap-usage"></a>
146<div class="header">
147<p>
148Next: <a href="#update_002dleap-source_002durl" accesskey="n" rel="next">update-leap source-url</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
149</div>
150<a name="update_002dleap-help_002fusage-_0028_002d_002dhelp_0029"></a>
151<h4 class="subsection">1.1 update-leap help/usage (<samp>--help</samp>)</h4>
152<a name="index-update_002dleap-help"></a>
153
154<p>This is the automatically generated usage text for update-leap.
155</p>
156<p>The text printed is the same whether selected with the <code>help</code> option
157(<samp>--help</samp>) or the <code>more-help</code> option (<samp>--more-help</samp>).  <code>more-help</code> will print
158the usage text by passing it through a pager program.
159<code>more-help</code> is disabled on platforms without a working
160<code>fork(2)</code> function.  The <code>PAGER</code> environment variable is
161used to select the program, defaulting to <samp>more</samp>.  Both will exit
162with a status code of 0.
163</p>
164<div class="example">
165<pre class="example">
166
167Usage: update-leap [options]
168
169Verifies and if necessary, updates leap-second definition file
170
171All arguments are optional:  Default (or current value) shown:
172    -C    Absolute path to CA Cert (see SSL/TLS Considerations)
173    -D    Path to a CAdir (see SSL/TLS Considerations)
174    -e    Specify how long (in days) before expiration the file is to be
175              refreshed.  Note that larger values imply more frequent refreshes.
176          60
177    -F    Force update even if current file is OK and not close to expiring.
178    -f    Absolute path ntp.conf file (default /etc/ntp.conf)
179          /etc/ntp.conf
180    -h    show help
181    -i    Specify number of minutes between retries
182          10
183    -L    Absolute path to leapfile on the local system
184          (overrides value in ntp.conf)
185    -l    Specify the syslog(3) facility for logging
186          LOG_USER
187    -q    Only report errors (cannot be used with -v)
188    -r    Specify number of attempts to retrieve file
189          6
190    -s    Send output to syslog(3) - implied if STDOUT has no tty or redirected
191    -t    Send output to terminal - implied if STDOUT attached to terminal
192    -u    Specify the URL of the master copy to download
193          https://www.ietf.org/timezones/data/leap-seconds.list
194    -v    Verbose - show debug messages (cannot be used with -q)
195
196The following options are not (yet) implemented in the perl version:
197    -4    Use only IPv4
198    -6    Use only IPv6
199    -c    Command to restart NTP after installing a new file
200          &lt;none&gt; - ntpd checks file daily
201    -p 4|6
202          Prefer IPv4 or IPv6 (as specified) addresses, but use either
203
204update-leap will validate the file currently on the local system.
205
206Ordinarily, the leapfile is found using the 'leapfile' directive in
207/etc/ntp.conf.  However, an alternate location can be specified on the
208command line with the -L flag.
209
210If the leapfile does not exist, is not valid, has expired, or is
211expiring soon, a new copy will be downloaded.  If the new copy is
212valid, it is installed.
213
214If the current file is acceptable, no download or restart occurs.
215
216This can be run as a cron job.  As the file is rarely updated, and
217leap seconds are announced at least one month in advance (usually
218longer), it need not be run more frequently than about once every
219three weeks.
220
221SSL/TLS Considerations
222-----------------------
223The perl modules can usually locate the CA certificate used to verify
224the peer's identity.
225
226On BSDs, the default is typically the file /etc/ssl/certs.pem.  On
227Linux, the location is typically a path to a CAdir - a directory of
228symlinks named according to a hash of the certificates' subject names.
229
230The -C or -D options are available to pass in a location if no CA cert
231is found in the default location.
232
233External Dependencies
234---------------------
235The following perl modules are required:
236HTTP::Tiny         - version &gt;= 0.056
237IO::Socket::SSL - version &gt;= 1.56
238NET::SSLeay         - version &gt;= 1.49
239
240Version: 1.004
241</pre></div>
242
243<hr>
244<a name="update_002dleap-source_002durl"></a>
245<div class="header">
246<p>
247Next: <a href="#update_002dleap-ipv4" accesskey="n" rel="next">update-leap ipv4</a>, Previous: <a href="#update_002dleap-usage" accesskey="p" rel="prev">update-leap usage</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
248</div>
249<a name="source_002durl-option-_0028_002ds_0029"></a>
250<h4 class="subsection">1.2 source-url option (-s)</h4>
251<a name="index-update_002dleap_002dsource_002durl"></a>
252
253<p>This is the &ldquo;the url of the master copy of the leapseconds file&rdquo; option.
254This option takes a string argument.
255Specify the URL of the master copy to download
256$LEAPSRC
257</p><hr>
258<a name="update_002dleap-ipv4"></a>
259<div class="header">
260<p>
261Next: <a href="#update_002dleap-destination" accesskey="n" rel="next">update-leap destination</a>, Previous: <a href="#update_002dleap-source_002durl" accesskey="p" rel="prev">update-leap source-url</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
262</div>
263<a name="ipv4-option-_0028_002d4_0029"></a>
264<h4 class="subsection">1.3 ipv4 option (-4)</h4>
265<a name="index-update_002dleap_002dipv4"></a>
266
267<p>This is the &ldquo;use only ipv4 addresses for dns name resolution&rdquo; option.
268</p>
269<p>This option has some usage constraints.  It:
270</p><ul>
271<li> must not appear in combination with any of the following options:
272ipv6.
273</li></ul>
274
275<p>Force DNS resolution of following host names on the command line
276        to the IPv4 namespace.
277        _EndOfDoc_;
278;
279</p>
280<p>flag =
281    name      = ipv6;
282    flags-cant = ipv4, prefer;
283    value     = 6;
284    descrip   = &quot;Use only IPv6 addresses for DNS name resolution&quot;;
285    doc = &lt;&lt;-  _EndOfDoc_
286        Force DNS resolution of following host names on the command line
287        to the IPv6 namespace.
288        _EndOfDoc_;
289;
290</p>
291<p>flag =
292    name        = prefer;
293    flags-cant	= ipv4, ipv6;
294    value	= p;
295    arg-type    = keyword;
296    keyword	= 4, 6;
297    descrip     = &rsquo;Prefer IPv4 or IPv6 (as specified) addresses, but use either&rsquo;;
298    doc         = &lt;&lt;-  _EndOfDoc_
299Prefer IPv4 or IPv6 (as specified) addresses, but use either.
300</p><hr>
301<a name="update_002dleap-destination"></a>
302<div class="header">
303<p>
304Next: <a href="#update_002dleap-expiration" accesskey="n" rel="next">update-leap expiration</a>, Previous: <a href="#update_002dleap-ipv4" accesskey="p" rel="prev">update-leap ipv4</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
305</div>
306<a name="destination-option-_0028_002dd_0029"></a>
307<h4 class="subsection">1.4 destination option (-d)</h4>
308<a name="index-update_002dleap_002ddestination"></a>
309
310<p>This is the &ldquo;filename on the local system&rdquo; option.
311This option takes a string argument <samp>float</samp>.
312The name to use to store the leapfile on the local system.
313$LEAPFILE
314</p><hr>
315<a name="update_002dleap-expiration"></a>
316<div class="header">
317<p>
318Next: <a href="#update_002dleap-ntp_002dconf_002dfile" accesskey="n" rel="next">update-leap ntp-conf-file</a>, Previous: <a href="#update_002dleap-destination" accesskey="p" rel="prev">update-leap destination</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
319</div>
320<a name="expiration-option-_0028_002de_0029"></a>
321<h4 class="subsection">1.5 expiration option (-e)</h4>
322<a name="index-update_002dleap_002dexpiration"></a>
323
324<p>This is the &ldquo;refresh the leapfile this long before it expires&rdquo; option.
325This option takes a string argument.
326Specify how long before expiration the file is to be refreshed
327Units are required, e.g. &quot;-e 60 days&quot;  Note that larger values
328imply more frequent refreshes.
329&quot;$PREFETCH&quot;
330</p><hr>
331<a name="update_002dleap-ntp_002dconf_002dfile"></a>
332<div class="header">
333<p>
334Next: <a href="#update_002dleap-force_002dupdate" accesskey="n" rel="next">update-leap force-update</a>, Previous: <a href="#update_002dleap-expiration" accesskey="p" rel="prev">update-leap expiration</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
335</div>
336<a name="ntp_002dconf_002dfile-option-_0028_002df_0029"></a>
337<h4 class="subsection">1.6 ntp-conf-file option (-f)</h4>
338<a name="index-update_002dleap_002dntp_002dconf_002dfile"></a>
339
340<p>This is the &ldquo;location of the ntp.conf file&rdquo; option.
341This option takes a string argument.
342Specify location of ntp.conf (used to make sure leapfile directive is
343present and to default  leapfile)
344/etc/ntp.conf
345</p><hr>
346<a name="update_002dleap-force_002dupdate"></a>
347<div class="header">
348<p>
349Next: <a href="#update_002dleap-exit-status" accesskey="n" rel="next">update-leap exit status</a>, Previous: <a href="#update_002dleap-ntp_002dconf_002dfile" accesskey="p" rel="prev">update-leap ntp-conf-file</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
350</div>
351<a name="force_002dupdate-option-_0028_002dF_0029"></a>
352<h4 class="subsection">1.7 force-update option (-F)</h4>
353<a name="index-update_002dleap_002dforce_002dupdate"></a>
354
355<p>This is the &ldquo;force update of the leapfile&rdquo; option.
356Force update even if current file is OK and not close to expiring.
357</p><hr>
358<a name="update_002dleap-exit-status"></a>
359<div class="header">
360<p>
361Next: <a href="#update_002dleap-Usage" accesskey="n" rel="next">update-leap Usage</a>, Previous: <a href="#update_002dleap-force_002dupdate" accesskey="p" rel="prev">update-leap force-update</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
362</div>
363<a name="update_002dleap-exit-status-1"></a>
364<h4 class="subsection">1.8 update-leap exit status</h4>
365
366<p>One of the following exit values will be returned:
367</p><dl compact="compact">
368<dt>&lsquo;<samp>0 (EXIT_SUCCESS)</samp>&rsquo;</dt>
369<dd><p>Successful program execution.
370</p></dd>
371<dt>&lsquo;<samp>1 (EXIT_FAILURE)</samp>&rsquo;</dt>
372<dd><p>The operation failed or the command syntax was not valid.
373</p></dd>
374</dl>
375<hr>
376<a name="update_002dleap-Usage"></a>
377<div class="header">
378<p>
379Next: <a href="#update_002dleap-Authors" accesskey="n" rel="next">update-leap Authors</a>, Previous: <a href="#update_002dleap-exit-status" accesskey="p" rel="prev">update-leap exit status</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
380</div>
381<a name="update_002dleap-Usage-1"></a>
382<h4 class="subsection">1.9 update-leap Usage</h4>
383<hr>
384<a name="update_002dleap-Authors"></a>
385<div class="header">
386<p>
387Previous: <a href="#update_002dleap-Usage" accesskey="p" rel="prev">update-leap Usage</a>, Up: <a href="#update_002dleap-Invocation" accesskey="u" rel="up">update-leap Invocation</a> &nbsp; </p>
388</div>
389<a name="update_002dleap-Authors-1"></a>
390<h4 class="subsection">1.10 update-leap Authors</h4>
391<hr>
392
393
394
395</body>
396</html>
397