sntp.1sntpmdoc revision 1.1.1.2.10.2 1 .Dd December 19 2014
2 .Dt SNTP 1sntpmdoc User Commands
3 .Os
4 .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
5 .\"
6 .\" It has been AutoGen-ed December 19, 2014 at 07:51:38 AM by AutoGen 5.18.5pre4
7 .\" From the definitions sntp-opts.def
8 .\" and the template file agmdoc-cmd.tpl
9 .Sh NAME
10 .Nm sntp
11 .Nd standard Simple Network Time Protocol client program
12 .Sh SYNOPSIS
13 .Nm
14 .\" Mixture of short (flag) options and long options
15 .Op Fl flags
16 .Op Fl flag Op Ar value
17 .Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
18 [ hostname\-or\-IP ...]
19 .Pp
20 .Sh DESCRIPTION
21 .Nm
22 can be used as an SNTP client to query a NTP or SNTP server and either display
23 the time or set the local system's time (given suitable privilege). It can be
24 run as an interactive command or from a
25 .Ic cron
26 job.
27 NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
28 are defined and described by RFC 5905.
29 .Pp
30 The default is to write the estimated correct local date and time (i.e. not
31 UTC) to the standard output in a format like:
32 .Ic "'1996\-10\-15 20:17:25.123 (+0800) +4.567 +/\- 0.089 [host] IP sN'"
33 where the
34 .Ic "'(+0800)'"
35 means that to get to UTC from the reported local time one must
36 add 8 hours and 0 minutes,
37 the
38 .Ic "'+4.567'"
39 indicates the local clock is 4.567 seconds behind the correct time
40 (so 4.567 seconds must be added to the local clock to get it to be correct).
41 Note that the number of decimals printed for this value will change
42 based on the reported precision of the server.
43 .Ic "'+/\- 0.089'"
44 is the reported
45 .Em synchronization distance
46 (in seconds), which represents the maximum error due to all causes.
47 If the server does not report valid data needed to calculate the
48 synchronization distance, this will be reported as
49 .Ic "'+/\- ?'" .
50 If the
51 .Em host
52 is different from the
53 .Em IP ,
54 both will be displayed.
55 Otherwise, only the
56 .Em IP
57 is displayed.
58 Finally, the
59 .Em stratum
60 of the host is reported.
61 .Sh "OPTIONS"
62 .Bl -tag
63 .It Fl 4 , Fl \-ipv4
64 Force IPv4 DNS name resolution.
65 This option must not appear in combination with any of the following options:
66 ipv6.
67 .sp
68 Force DNS resolution of the following host names on the command line
69 to the IPv4 namespace.
70 .It Fl 6 , Fl \-ipv6
71 Force IPv6 DNS name resolution.
72 This option must not appear in combination with any of the following options:
73 ipv4.
74 .sp
75 Force DNS resolution of the following host names on the command line
76 to the IPv6 namespace.
77 .It Fl a Ar auth\-keynumber , Fl \-authentication Ns = Ns Ar auth\-keynumber
78 Enable authentication with the key \fBauth\-keynumber\fP.
79 This option takes an integer number as its argument.
80 .sp
81 Enable authentication using the key specified in this option's
82 argument. The argument of this option is the \fBkeyid\fP, a
83 number specified in the \fBkeyfile\fP as this key's identifier.
84 See the \fBkeyfile\fP option (\fB\-k\fP) for more details.
85 .It Fl b Ar broadcast\-address , Fl \-broadcast Ns = Ns Ar broadcast\-address
86 Listen to the address specified for broadcast time sync.
87 This option may appear an unlimited number of times.
88 .sp
89 If specified \fBsntp\fP will listen to the specified address
90 for NTP broadcasts. The default maximum wait time
91 can (and probably should) be modified with \fB\-t\fP.
92 .It Fl c Ar host\-name , Fl \-concurrent Ns = Ns Ar host\-name
93 Concurrently query all IPs returned for host\-name.
94 This option may appear an unlimited number of times.
95 .sp
96 Requests from an NTP "client" to a "server" should never be sent
97 more rapidly than one every 2 seconds. By default, any IPs returned
98 as part of a DNS lookup are assumed to be for a single instance of
99 \fBntpd\fP, and therefore \fBsntp\fP will send queries to these IPs
100 one after another, with a 2\-second gap in between each query.
101 .sp
102 The \fB\-c\fP or \fB\-\-concurrent\fP flag says that any IPs
103 returned for the DNS lookup of the supplied host\-name are on
104 different machines, so we can send concurrent queries.
105 .It Fl d , Fl \-debug\-level
106 Increase debug verbosity level.
107 This option may appear an unlimited number of times.
108 .sp
109 .It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
110 Set the debug verbosity level.
111 This option may appear an unlimited number of times.
112 This option takes an integer number as its argument.
113 .sp
114 .It Fl g Ar milliseconds , Fl \-gap Ns = Ns Ar milliseconds
115 The gap (in milliseconds) between time requests.
116 This option takes an integer number as its argument.
117 The default
118 .Ar milliseconds
119 for this option is:
120 .ti +4
121 50
122 .sp
123 Since we're only going to use the first valid response we get and
124 there is benefit to specifying a good number of servers to query,
125 separate the queries we send out by the specified number of
126 milliseconds.
127 .It Fl K Ar file\-name , Fl \-kod Ns = Ns Ar file\-name
128 KoD history filename.
129 The default
130 .Ar file\-name
131 for this option is:
132 .ti +4
133 /var/db/ntp\-kod
134 .sp
135 Specifies the filename to be used for the persistent history of KoD
136 responses received from servers. If the file does not exist, a
137 warning message will be displayed. The file will not be created.
138 .It Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name
139 Look in this file for the key specified with \fB\-a\fP.
140 .sp
141 This option specifies the keyfile.
142 \fBsntp\fP will search for the key specified with \fB\-a\fP
143 \fIkeyno\fP in this file. See \fBntp.keys(5)\fP for more
144 information.
145 .It Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name
146 Log to specified logfile.
147 .sp
148 This option causes the client to write log messages to the specified
149 \fIlogfile\fP.
150 .It Fl M Ar number , Fl \-steplimit Ns = Ns Ar number
151 Adjustments less than \fBsteplimit\fP msec will be slewed.
152 This option takes an integer number as its argument.
153 The value of
154 .Ar number
155 is constrained to being:
156 .in +4
157 .nf
158 .na
159 greater than or equal to 0
160 .fi
161 .in -4
162 .sp
163 If the time adjustment is less than \fIsteplimit\fP milliseconds,
164 slew the amount using \fBadjtime(2)\fP. Otherwise, step the
165 correction using \fBsettimeofday(2)\fP.
166 .It Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number
167 Send \fBint\fP as our NTP protocol version.
168 This option takes an integer number as its argument.
169 The value of
170 .Ar number
171 is constrained to being:
172 .in +4
173 .nf
174 .na
175 in the range 0 through 7
176 .fi
177 .in -4
178 The default
179 .Ar number
180 for this option is:
181 .ti +4
182 4
183 .sp
184 When sending requests to a remote server, tell them we are running
185 NTP protocol version \fIntpversion\fP .
186 .It Fl r , Fl \-usereservedport
187 Use the NTP Reserved Port (port 123).
188 .sp
189 Use port 123, which is reserved for NTP, for our network
190 communications.
191 .It Fl S , Fl \-step
192 OK to 'step' the time with \fBsettimeofday(2)\fP.
193 .sp
194 .It Fl s , Fl \-slew
195 OK to 'slew' the time with \fBadjtime(2)\fP.
196 .sp
197 .It Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds
198 The number of seconds to wait for responses.
199 This option takes an integer number as its argument.
200 The default
201 .Ar seconds
202 for this option is:
203 .ti +4
204 5
205 .sp
206 When waiting for a reply, \fBsntp\fP will wait the number
207 of seconds specified before giving up. The default should be
208 more than enough for a unicast response. If \fBsntp\fP is
209 only waiting for a broadcast response a longer timeout is
210 likely needed.
211 .It Fl \-wait , " Fl \-no\-wait"
212 Wait for pending replies (if not setting the time).
213 The \fIno\-wait\fP form will disable the option.
214 This option is enabled by default.
215 .sp
216 If we are not setting the time, wait for all pending responses.
217 .It Fl \&? , Fl \-help
218 Display usage information and exit.
219 .It Fl \&! , Fl \-more\-help
220 Pass the extended usage information through a pager.
221 .It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
222 Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
223 configuration file listed in the \fBOPTION PRESETS\fP section, below.
224 The command will exit after updating the config file.
225 .It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
226 Load options from \fIcfgfile\fP.
227 The \fIno\-load\-opts\fP form will disable the loading
228 of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early,
229 out of order.
230 .It Fl \-version Op Brq Ar v|c|n
231 Output version of program and exit. The default mode is `v', a simple
232 version. The `c' mode will print copyright information and `n' will
233 print the full copyright notice.
234 .El
235 .Sh "OPTION PRESETS"
236 Any option that is not marked as \fInot presettable\fP may be preset
237 by loading values from configuration ("RC" or ".INI") file(s) and values from
238 environment variables named:
239 .nf
240 \fBSNTP_<option\-name>\fP or \fBSNTP\fP
241 .fi
242 .ad
243 The environmental presets take precedence (are processed later than)
244 the configuration files.
245 The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
246 If any of these are directories, then the file \fI.ntprc\fP
247 is searched for within those directories.
248 .Sh USAGE
249 .Bl -tag -width indent
250 .It Li "sntp ntpserver.somewhere"
251 is the simplest use of this program
252 and can be run as an unprivileged command
253 to check the current time and error in the local clock.
254 .It Li "sntp \-a ntpserver.somewhere"
255 With suitable privilege,
256 run as a command
257 or from a
258 .Xr cron 8
259 job,
260 .Ic "sntp \-a"
261 will reset the local clock from a synchronized specified server,
262 like the (deprecated)
263 .Xr ntpdate 1ntpdatemdoc ,
264 or
265 .Xr rdate 8
266 commands.
267 .El
268 .Sh "ENVIRONMENT"
269 See \fBOPTION PRESETS\fP for configuration environment variables.
270 .Sh "FILES"
271 See \fBOPTION PRESETS\fP for configuration files.
272 .Sh "EXIT STATUS"
273 One of the following exit values will be returned:
274 .Bl -tag
275 .It 0 " (EXIT_SUCCESS)"
276 Successful program execution.
277 .It 1 " (EXIT_FAILURE)"
278 The operation failed or the command syntax was not valid.
279 .It 66 " (EX_NOINPUT)"
280 A specified configuration file could not be loaded.
281 .It 70 " (EX_SOFTWARE)"
282 libopts had an internal operational error. Please report
283 it to autogen\-users (a] lists.sourceforge.net. Thank you.
284 .El
285 .Sh AUTHORS
286 .An "Johannes Maximilian Kuehn"
287 .An "Harlan Stenn"
288 .An "Dave Hart"
289 .Sh "COPYRIGHT"
290 Copyright (C) 1970\-2014 The University of Delaware all rights reserved.
291 This program is released under the terms of the NTP license, <http://ntp.org/license>.
292 .Sh "BUGS"
293 Please send bug reports to: http://bugs.ntp.org, bugs (a] ntp.org
294 .Sh "NOTES"
295 This manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP
296 option definitions.
297