xref: /freebsd/contrib/ntp/ntpdc/invoke-ntpdc.texi (revision bdd1243d)
1@node ntpdc Invocation
2@section Invoking ntpdc
3@pindex ntpdc
4@cindex vendor-specific NTPD control program
5@ignore
6#
7# EDIT THIS FILE WITH CAUTION  (invoke-ntpdc.texi)
8#
9# It has been AutoGen-ed  June  6, 2023 at 04:37:59 AM by AutoGen 5.18.16
10# From the definitions    ntpdc-opts.def
11# and the template file   agtexi-cmd.tpl
12@end ignore
13
14
15
16@code{ntpdc}
17is deprecated.
18Please use
19@code{ntpq(1ntpqmdoc)} instead - it can do everything
20@code{ntpdc}
21used to do, and it does so using a much more sane interface.
22
23@code{ntpdc}
24is a utility program used to query
25@code{ntpd(1ntpdmdoc)}
26about its
27current state and to request changes in that state.
28It uses NTP mode 7 control message formats described in the source code.
29The program may
30be run either in interactive mode or controlled using command line
31arguments.
32Extensive state and statistics information is available
33through the
34@code{ntpdc}
35interface.
36In addition, nearly all the
37configuration options which can be specified at startup using
38ntpd's configuration file may also be specified at run time using
39@code{ntpdc}
40
41This section was generated by @strong{AutoGen},
42using the @code{agtexi-cmd} template and the option descriptions for the @code{ntpdc} program.
43This software is released under the NTP license, <http://ntp.org/license>.
44
45@menu
46* ntpdc usage::                  ntpdc help/usage (@option{--help})
47* ntpdc ipv4::                   ipv4 option (-4)
48* ntpdc ipv6::                   ipv6 option (-6)
49* ntpdc command::                command option (-c)
50* ntpdc interactive::            interactive option (-i)
51* ntpdc listpeers::              listpeers option (-l)
52* ntpdc numeric::                numeric option (-n)
53* ntpdc peers::                  peers option (-p)
54* ntpdc showpeers::              showpeers option (-s)
55* ntpdc unconnected::            unconnected option (-u)
56* ntpdc config::                 presetting/configuring ntpdc
57* ntpdc exit status::            exit status
58* ntpdc Usage::                  Usage
59* ntpdc See Also::               See Also
60* ntpdc Authors::                Authors
61* ntpdc Bugs::                   Bugs
62@end menu
63
64@node ntpdc usage
65@subsection ntpdc help/usage (@option{--help})
66@cindex ntpdc help
67
68This is the automatically generated usage text for ntpdc.
69
70The text printed is the same whether selected with the @code{help} option
71(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
72the usage text by passing it through a pager program.
73@code{more-help} is disabled on platforms without a working
74@code{fork(2)} function.  The @code{PAGER} environment variable is
75used to select the program, defaulting to @file{more}.  Both will exit
76with a status code of 0.
77
78@exampleindent 0
79@example
80ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p17
81Usage:  ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
82  Flg Arg Option-Name    Description
83   -4 no  ipv4           Force IPv4 DNS name resolution
84                                - prohibits the option 'ipv6'
85   -6 no  ipv6           Force IPv6 DNS name resolution
86                                - prohibits the option 'ipv4'
87   -c Str command        run a command and exit
88                                - may appear multiple times
89   -d no  debug-level    Increase debug verbosity level
90                                - may appear multiple times
91   -D Num set-debug-level Set the debug verbosity level
92                                - may appear multiple times
93   -i no  interactive    Force ntpq to operate in interactive mode
94                                - prohibits these options:
95                                command
96                                listpeers
97                                peers
98                                showpeers
99   -l no  listpeers      Print a list of the peers
100                                - prohibits the option 'command'
101   -n no  numeric        numeric host addresses
102   -p no  peers          Print a list of the peers
103                                - prohibits the option 'command'
104   -s no  showpeers      Show a list of the peers
105                                - prohibits the option 'command'
106   -u no  unconnected    Use unconnected UDP to communicate with ntpd (default on Windows)
107      opt version        output version information and exit
108   -? no  help           display extended usage information and exit
109   -! no  more-help      extended usage information passed thru pager
110   -> opt save-opts      save the option state to a config file
111   -< Str load-opts      load options from a config file
112                                - disabled as '--no-load-opts'
113                                - may appear multiple times
114
115Options are specified by doubled hyphens and their name or by a single
116hyphen and the flag character.
117
118
119The following option preset mechanisms are supported:
120 - reading file $HOME/.ntprc
121 - reading file ./.ntprc
122 - examining environment variables named NTPDC_*
123
124Please send bug reports to:  <https://bugs.ntp.org, bugs@@ntp.org>
125@end example
126@exampleindent 4
127
128@node ntpdc ipv4
129@subsection ipv4 option (-4)
130@cindex ntpdc-ipv4
131
132This is the ``force ipv4 dns name resolution'' option.
133
134@noindent
135This option has some usage constraints.  It:
136@itemize @bullet
137@item
138must not appear in combination with any of the following options:
139ipv6.
140@end itemize
141
142Force DNS resolution of following host names on the command line
143to the IPv4 namespace.
144@node ntpdc ipv6
145@subsection ipv6 option (-6)
146@cindex ntpdc-ipv6
147
148This is the ``force ipv6 dns name resolution'' option.
149
150@noindent
151This option has some usage constraints.  It:
152@itemize @bullet
153@item
154must not appear in combination with any of the following options:
155ipv4.
156@end itemize
157
158Force DNS resolution of following host names on the command line
159to the IPv6 namespace.
160@node ntpdc command
161@subsection command option (-c)
162@cindex ntpdc-command
163
164This is the ``run a command and exit'' option.
165This option takes a string argument @file{cmd}.
166
167@noindent
168This option has some usage constraints.  It:
169@itemize @bullet
170@item
171may appear an unlimited number of times.
172@end itemize
173
174The following argument is interpreted as an interactive format command
175and is added to the list of commands to be executed on the specified
176host(s).
177@node ntpdc interactive
178@subsection interactive option (-i)
179@cindex ntpdc-interactive
180
181This is the ``force ntpq to operate in interactive mode'' option.
182
183@noindent
184This option has some usage constraints.  It:
185@itemize @bullet
186@item
187must not appear in combination with any of the following options:
188command, listpeers, peers, showpeers.
189@end itemize
190
191Force ntpq to operate in interactive mode.  Prompts will be written
192to the standard output and commands read from the standard input.
193@node ntpdc listpeers
194@subsection listpeers option (-l)
195@cindex ntpdc-listpeers
196
197This is the ``print a list of the peers'' option.
198
199@noindent
200This option has some usage constraints.  It:
201@itemize @bullet
202@item
203must not appear in combination with any of the following options:
204command.
205@end itemize
206
207Print a list of the peers known to the server as well as a summary of
208their state. This is equivalent to the 'listpeers' interactive command.
209@node ntpdc numeric
210@subsection numeric option (-n)
211@cindex ntpdc-numeric
212
213This is the ``numeric host addresses'' option.
214Output all host addresses in dotted-quad numeric format rather than
215converting to the canonical host names.
216@node ntpdc peers
217@subsection peers option (-p)
218@cindex ntpdc-peers
219
220This is the ``print a list of the peers'' option.
221
222@noindent
223This option has some usage constraints.  It:
224@itemize @bullet
225@item
226must not appear in combination with any of the following options:
227command.
228@end itemize
229
230Print a list of the peers known to the server as well as a summary
231of their state. This is equivalent to the 'peers' interactive command.
232@node ntpdc showpeers
233@subsection showpeers option (-s)
234@cindex ntpdc-showpeers
235
236This is the ``show a list of the peers'' option.
237
238@noindent
239This option has some usage constraints.  It:
240@itemize @bullet
241@item
242must not appear in combination with any of the following options:
243command.
244@end itemize
245
246Print a list of the peers known to the server as well as a summary
247of their state. This is equivalent to the 'dmpeers' interactive command.
248@node ntpdc unconnected
249@subsection unconnected option (-u)
250@cindex ntpdc-unconnected
251
252This is the ``use unconnected udp to communicate with ntpd (default on windows)'' option.
253Open an unconnected UDP association to ntpd (the default
254on Windows).
255
256
257@node ntpdc config
258@subsection presetting/configuring ntpdc
259
260Any option that is not marked as @i{not presettable} may be preset by
261loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{NTPDC} and @code{NTPDC_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
262the options listed above in upper case and segmented with underscores.
263The @code{NTPDC} variable will be tokenized and parsed like
264the command line.  The remaining variables are tested for existence and their
265values are treated like option arguments.
266
267
268@noindent
269@code{libopts} will search in 2 places for configuration files:
270@itemize @bullet
271@item
272$HOME
273@item
274$PWD
275@end itemize
276The environment variables @code{HOME}, and @code{PWD}
277are expanded and replaced when @file{ntpdc} runs.
278For any of these that are plain files, they are simply processed.
279For any that are directories, then a file named @file{.ntprc} is searched for
280within that directory and processed.
281
282Configuration files may be in a wide variety of formats.
283The basic format is an option name followed by a value (argument) on the
284same line.  Values may be separated from the option name with a colon,
285equal sign or simply white space.  Values may be continued across multiple
286lines by escaping the newline with a backslash.
287
288Multiple programs may also share the same initialization file.
289Common options are collected at the top, followed by program specific
290segments.  The segments are separated by lines like:
291@example
292[NTPDC]
293@end example
294@noindent
295or by
296@example
297<?program ntpdc>
298@end example
299@noindent
300Do not mix these styles within one configuration file.
301
302Compound values and carefully constructed string values may also be
303specified using XML syntax:
304@example
305<option-name>
306   <sub-opt>...&lt;...&gt;...</sub-opt>
307</option-name>
308@end example
309@noindent
310yielding an @code{option-name.sub-opt} string value of
311@example
312"...<...>..."
313@end example
314@code{AutoOpts} does not track suboptions.  You simply note that it is a
315hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
316the associated name/value pair list (see: optionFindValue).
317
318The command line options relating to configuration and/or usage help are:
319
320@subsubheading version (-)
321
322Print the program version to standard out, optionally with licensing
323information, then exit 0.  The optional argument specifies how much licensing
324detail to provide.  The default is to print just the version.  The licensing information may be selected with an option argument.
325Only the first letter of the argument is examined:
326
327@table @samp
328@item version
329Only print the version.  This is the default.
330@item copyright
331Name the copyright usage licensing terms.
332@item verbose
333Print the full copyright usage licensing terms.
334@end table
335
336@node ntpdc exit status
337@subsection ntpdc exit status
338
339One of the following exit values will be returned:
340@table @samp
341@item 0 (EXIT_SUCCESS)
342Successful program execution.
343@item 1 (EXIT_FAILURE)
344The operation failed or the command syntax was not valid.
345@item 66 (EX_NOINPUT)
346A specified configuration file could not be loaded.
347@item 70 (EX_SOFTWARE)
348libopts had an internal operational error.  Please report
349it to autogen-users@@lists.sourceforge.net.  Thank you.
350@end table
351@node ntpdc Usage
352@subsection ntpdc Usage
353@node ntpdc See Also
354@subsection ntpdc See Also
355@node ntpdc Authors
356@subsection ntpdc Authors
357@node ntpdc Bugs
358@subsection ntpdc Bugs
359