]> git.pld-linux.org Git - packages/ntp.git/blob - ntpdate.8
- run ntpdate also from cron
[packages/ntp.git] / ntpdate.8
1 .TH ntpdate 8
2 .SH NAME
3 ntpdate \- set the date and time via NTP
4 .SH SYNOPSIS
5 .B ntpdate 
6 .RB [\| \-bBdoqsuv \|] 
7 .RB [\| \-a 
8 .IR key \|] 
9 .RB [\| \-e 
10 .IR authdelay \|] 
11 .RB [\| \-k 
12 .IR keyfile \|]
13 .RB [\| \-o
14 .IR version \|]
15 .RB [\| \-p
16 .IR samples \|]
17 .RB [\| \-t
18 .IR timeout \|]
19 .IR server
20 .RB [\| ... \|]
21 .SH DESCRIPTION
22 .B ntpdate 
23 sets the local date and time by polling the Network Time
24 Protocol (NTP) server(s) given as the
25 .I server 
26 arguments to determine
27 the correct time. It must be run as root on the local host. A number
28 of samples are obtained from each of the servers specified and a
29 subset of the NTP clock filter and selection algorithms are applied to
30 select the best of these. Note that the accuracy and reliability of
31 ntpdate depends on the number of servers, the number of polls each
32 time it is run and the interval between runs.
33
34 ntpdate can be run manually as necessary to set the host clock, or it
35 can be run from the host startup script to set the clock at boot time.
36 This is useful in some cases to set the clock initially before
37 starting the NTP daemon ntpd. It is also possible to run ntpdate from
38 a cron script. However, it is important to note that ntpdate with
39 contrived cron scripts is no substitute for the NTP daemon, which uses
40 sophisticated algorithms to maximize accuracy and reliability while
41 minimizing resource use. Finally, since ntpdate does not discipline
42 the host clock frequency as does ntpd, the accuracy using ntpdate is
43 limited.
44
45 Time adjustments are made by ntpdate in one of two ways. If ntpdate
46 determines the clock is in error more than 0.5 second it will simply
47 step the time by calling the system settimeofday() routine. If the
48 error is less than 0.5 seconds, it will slew the time by calling the
49 system adjtime() routine. The latter technique is less disruptive and
50 more accurate when the error is small, and works quite well when
51 ntpdate is run by cron every hour or two.
52
53 ntpdate will decline to set the date if an NTP server daemon (e.g.,
54 ntpd) is running on the same host. When running ntpdate on a regular
55 basis from cron as an alternative to running a daemon, doing so once
56 every hour or two will result in precise enough timekeeping to avoid
57 stepping the clock.
58 .SH OPTIONS
59 .TP
60 .BI \-a \ key
61 Enable the authentication function and specify the key
62 identifier to be used for authentication as the argument
63 keyntpdate. The keys and key identifiers must match in both the
64 client and server key files. The default is to disable the
65 authentication function.
66 .TP
67 .B \-B
68 Force the time to always be slewed using the adjtime() system
69 call, even if the measured offset is greater than +-128 ms. The
70 default is to step the time using settimeofday() if the offset
71 is greater than +-128 ms. Note that, if the offset is much
72 greater than +-128 ms in this case, that it can take a long
73 time (hours) to slew the clock to the correct value. During
74 this time. the host should not be used to synchronize clients.
75 .TP
76 .B \-b
77 Force the time to be stepped using the settimeofday() system
78 call, rather than slewed (default) using the adjtime() system
79 call. This option should be used when called from a startup
80 file at boot time.
81 .TP
82 .B \-d
83 Enable the debugging mode, in which ntpdate will go through all
84 the steps, but not adjust the local clock. Information useful
85 for general debugging will also be printed.
86 .TP
87 .BI \-e \ authdelay
88 Specify the processing delay to perform an authentication
89 function as the value authdelay, in seconds and fraction (see
90 ntpd for details). This number is usually small enough to be
91 negligible for most purposes, though specifying a value may
92 improve timekeeping on very slow CPU's.
93 .TP
94 .BI \-k \ keyfile
95 Specify the path for the authentication key file as the string
96 keyfile. The default is /etc/ntp.keys. This file should be in
97 the format described in ntpd.
98 .TP
99 .BI \-o \ version
100 Specify the NTP version for outgoint packets as the integer
101 version, which can be 1 or 2. The default is 3. This allows
102 ntpdate to be used with older NTP versions.
103 .TP
104 .BI \-p \ samples
105 Specify the number of samples to be acquired from each server
106 as the integer samples, with values from 1 to 8 inclusive. The
107 default is 4.
108 .TP
109 .B \-q
110 Query only - don't set the clock.
111 .TP
112 .B \-s
113 Divert logging output from the standard output (default) to the
114 system syslog facility. This is designed primarily for
115 convenience of cron scripts.
116 .TP
117 .BI \-t \ timeout
118 Specify the maximum time waiting for a server response as the
119 value timeout, in seconds and fraction. The value is is rounded
120 to a multiple of 0.2 seconds. The default is 1 second, a value
121 suitable for polling across a LAN.
122 .TP
123 .B \-u
124 Direct ntpdate to use an unprivileged port or outgoing packets.
125 This is most useful when behind a firewall that blocks incoming
126 traffic to privileged ports, and you want to synchronise with
127 hosts beyond the firewall. Note that the -d option always uses
128 unprivileged ports.
129 .TP
130 .B \-v
131 Be verbose. This option will cause ntpdate's version
132 identification string to be logged.
133 .SH FILES
134 .TP
135 .I /etc/ntp.keys 
136 \- encryption keys used by ntpdate.
137 .SH BUGS
138 The slew adjustment is actually 50% larger than the measured offset,
139 since this (it is argued) will tend to keep a badly drifting clock
140 more accurate. This is probably not a good idea and may cause a
141 troubling hunt for some values of the kernel variables tick and
142 tickadj.
143 .SH AUTHOR
144 David L. Mills (mills@udel.edu)
145 .br
146 This manpage converted from html to roff by 
147 Fabrizio Polacco <fpolacco@debian.org>
148
This page took 0.061657 seconds and 3 git commands to generate.