xref: /freebsd/contrib/ntp/ntpdc/invoke-ntpdc.texi (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
12b15cb3dSCy Schubert@node ntpdc Invocation
22b15cb3dSCy Schubert@section Invoking ntpdc
32b15cb3dSCy Schubert@pindex ntpdc
42b15cb3dSCy Schubert@cindex vendor-specific NTPD control program
52b15cb3dSCy Schubert@ignore
62b15cb3dSCy Schubert#
72b15cb3dSCy Schubert# EDIT THIS FILE WITH CAUTION  (invoke-ntpdc.texi)
82b15cb3dSCy Schubert#
9*f5f40dd6SCy Schubert# It has been AutoGen-ed  May 25, 2024 at 12:04:17 AM by AutoGen 5.18.16
102b15cb3dSCy Schubert# From the definitions    ntpdc-opts.def
112b15cb3dSCy Schubert# and the template file   agtexi-cmd.tpl
122b15cb3dSCy Schubert@end ignore
132b15cb3dSCy Schubert
142b15cb3dSCy Schubert
152b15cb3dSCy Schubert
162b15cb3dSCy Schubert@code{ntpdc}
172b15cb3dSCy Schubertis deprecated.
182b15cb3dSCy SchubertPlease use
192b15cb3dSCy Schubert@code{ntpq(1ntpqmdoc)} instead - it can do everything
202b15cb3dSCy Schubert@code{ntpdc}
212b15cb3dSCy Schubertused to do, and it does so using a much more sane interface.
222b15cb3dSCy Schubert
232b15cb3dSCy Schubert@code{ntpdc}
242b15cb3dSCy Schubertis a utility program used to query
252b15cb3dSCy Schubert@code{ntpd(1ntpdmdoc)}
262b15cb3dSCy Schubertabout its
272b15cb3dSCy Schubertcurrent state and to request changes in that state.
282b15cb3dSCy SchubertIt uses NTP mode 7 control message formats described in the source code.
292b15cb3dSCy SchubertThe program may
302b15cb3dSCy Schubertbe run either in interactive mode or controlled using command line
312b15cb3dSCy Schubertarguments.
322b15cb3dSCy SchubertExtensive state and statistics information is available
332b15cb3dSCy Schubertthrough the
342b15cb3dSCy Schubert@code{ntpdc}
352b15cb3dSCy Schubertinterface.
362b15cb3dSCy SchubertIn addition, nearly all the
372b15cb3dSCy Schubertconfiguration options which can be specified at startup using
382b15cb3dSCy Schubertntpd's configuration file may also be specified at run time using
392b15cb3dSCy Schubert@code{ntpdc}
402b15cb3dSCy Schubert
412b15cb3dSCy SchubertThis section was generated by @strong{AutoGen},
422b15cb3dSCy Schubertusing the @code{agtexi-cmd} template and the option descriptions for the @code{ntpdc} program.
432b15cb3dSCy SchubertThis software is released under the NTP license, <http://ntp.org/license>.
442b15cb3dSCy Schubert
452b15cb3dSCy Schubert@menu
462b15cb3dSCy Schubert* ntpdc usage::                  ntpdc help/usage (@option{--help})
472b15cb3dSCy Schubert* ntpdc ipv4::                   ipv4 option (-4)
482b15cb3dSCy Schubert* ntpdc ipv6::                   ipv6 option (-6)
492b15cb3dSCy Schubert* ntpdc command::                command option (-c)
502b15cb3dSCy Schubert* ntpdc interactive::            interactive option (-i)
512b15cb3dSCy Schubert* ntpdc listpeers::              listpeers option (-l)
522b15cb3dSCy Schubert* ntpdc numeric::                numeric option (-n)
532b15cb3dSCy Schubert* ntpdc peers::                  peers option (-p)
542b15cb3dSCy Schubert* ntpdc showpeers::              showpeers option (-s)
55a466cc55SCy Schubert* ntpdc unconnected::            unconnected option (-u)
562b15cb3dSCy Schubert* ntpdc config::                 presetting/configuring ntpdc
572b15cb3dSCy Schubert* ntpdc exit status::            exit status
582b15cb3dSCy Schubert* ntpdc Usage::                  Usage
592b15cb3dSCy Schubert* ntpdc See Also::               See Also
602b15cb3dSCy Schubert* ntpdc Authors::                Authors
612b15cb3dSCy Schubert* ntpdc Bugs::                   Bugs
622b15cb3dSCy Schubert@end menu
632b15cb3dSCy Schubert
642b15cb3dSCy Schubert@node ntpdc usage
652b15cb3dSCy Schubert@subsection ntpdc help/usage (@option{--help})
662b15cb3dSCy Schubert@cindex ntpdc help
672b15cb3dSCy Schubert
682b15cb3dSCy SchubertThis is the automatically generated usage text for ntpdc.
692b15cb3dSCy Schubert
702b15cb3dSCy SchubertThe text printed is the same whether selected with the @code{help} option
712b15cb3dSCy Schubert(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
722b15cb3dSCy Schubertthe usage text by passing it through a pager program.
732b15cb3dSCy Schubert@code{more-help} is disabled on platforms without a working
742b15cb3dSCy Schubert@code{fork(2)} function.  The @code{PAGER} environment variable is
752b15cb3dSCy Schubertused to select the program, defaulting to @file{more}.  Both will exit
762b15cb3dSCy Schubertwith a status code of 0.
772b15cb3dSCy Schubert
782b15cb3dSCy Schubert@exampleindent 0
792b15cb3dSCy Schubert@example
80*f5f40dd6SCy Schubertntpdc - vendor-specific NTPD control program - Ver. 4.2.8p18
812b15cb3dSCy SchubertUsage:  ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
822b15cb3dSCy Schubert  Flg Arg Option-Name    Description
832b15cb3dSCy Schubert   -4 no  ipv4           Force IPv4 DNS name resolution
842b15cb3dSCy Schubert                                - prohibits the option 'ipv6'
852b15cb3dSCy Schubert   -6 no  ipv6           Force IPv6 DNS name resolution
862b15cb3dSCy Schubert                                - prohibits the option 'ipv4'
872b15cb3dSCy Schubert   -c Str command        run a command and exit
882b15cb3dSCy Schubert                                - may appear multiple times
892b15cb3dSCy Schubert   -d no  debug-level    Increase debug verbosity level
902b15cb3dSCy Schubert                                - may appear multiple times
912b15cb3dSCy Schubert   -D Num set-debug-level Set the debug verbosity level
922b15cb3dSCy Schubert                                - may appear multiple times
932b15cb3dSCy Schubert   -i no  interactive    Force ntpq to operate in interactive mode
942b15cb3dSCy Schubert                                - prohibits these options:
952b15cb3dSCy Schubert                                command
962b15cb3dSCy Schubert                                listpeers
972b15cb3dSCy Schubert                                peers
982b15cb3dSCy Schubert                                showpeers
992b15cb3dSCy Schubert   -l no  listpeers      Print a list of the peers
1002b15cb3dSCy Schubert                                - prohibits the option 'command'
1012b15cb3dSCy Schubert   -n no  numeric        numeric host addresses
1022b15cb3dSCy Schubert   -p no  peers          Print a list of the peers
1032b15cb3dSCy Schubert                                - prohibits the option 'command'
1042b15cb3dSCy Schubert   -s no  showpeers      Show a list of the peers
1052b15cb3dSCy Schubert                                - prohibits the option 'command'
106a466cc55SCy Schubert   -u no  unconnected    Use unconnected UDP to communicate with ntpd (default on Windows)
1072b15cb3dSCy Schubert      opt version        output version information and exit
1082b15cb3dSCy Schubert   -? no  help           display extended usage information and exit
1092b15cb3dSCy Schubert   -! no  more-help      extended usage information passed thru pager
1102b15cb3dSCy Schubert   -> opt save-opts      save the option state to a config file
1112b15cb3dSCy Schubert   -< Str load-opts      load options from a config file
1122b15cb3dSCy Schubert                                - disabled as '--no-load-opts'
1132b15cb3dSCy Schubert                                - may appear multiple times
1142b15cb3dSCy Schubert
1152b15cb3dSCy SchubertOptions are specified by doubled hyphens and their name or by a single
1162b15cb3dSCy Schuberthyphen and the flag character.
1172b15cb3dSCy Schubert
1182b15cb3dSCy Schubert
1192b15cb3dSCy SchubertThe following option preset mechanisms are supported:
1202b15cb3dSCy Schubert - reading file $HOME/.ntprc
1212b15cb3dSCy Schubert - reading file ./.ntprc
1222b15cb3dSCy Schubert - examining environment variables named NTPDC_*
1232b15cb3dSCy Schubert
124a466cc55SCy SchubertPlease send bug reports to:  <https://bugs.ntp.org, bugs@@ntp.org>
1252b15cb3dSCy Schubert@end example
1262b15cb3dSCy Schubert@exampleindent 4
1272b15cb3dSCy Schubert
1282b15cb3dSCy Schubert@node ntpdc ipv4
1292b15cb3dSCy Schubert@subsection ipv4 option (-4)
1302b15cb3dSCy Schubert@cindex ntpdc-ipv4
1312b15cb3dSCy Schubert
1322b15cb3dSCy SchubertThis is the ``force ipv4 dns name resolution'' option.
1332b15cb3dSCy Schubert
1342b15cb3dSCy Schubert@noindent
1352b15cb3dSCy SchubertThis option has some usage constraints.  It:
1362b15cb3dSCy Schubert@itemize @bullet
1372b15cb3dSCy Schubert@item
1382b15cb3dSCy Schubertmust not appear in combination with any of the following options:
1392b15cb3dSCy Schubertipv6.
1402b15cb3dSCy Schubert@end itemize
1412b15cb3dSCy Schubert
1422b15cb3dSCy SchubertForce DNS resolution of following host names on the command line
1432b15cb3dSCy Schubertto the IPv4 namespace.
1442b15cb3dSCy Schubert@node ntpdc ipv6
1452b15cb3dSCy Schubert@subsection ipv6 option (-6)
1462b15cb3dSCy Schubert@cindex ntpdc-ipv6
1472b15cb3dSCy Schubert
1482b15cb3dSCy SchubertThis is the ``force ipv6 dns name resolution'' option.
1492b15cb3dSCy Schubert
1502b15cb3dSCy Schubert@noindent
1512b15cb3dSCy SchubertThis option has some usage constraints.  It:
1522b15cb3dSCy Schubert@itemize @bullet
1532b15cb3dSCy Schubert@item
1542b15cb3dSCy Schubertmust not appear in combination with any of the following options:
1552b15cb3dSCy Schubertipv4.
1562b15cb3dSCy Schubert@end itemize
1572b15cb3dSCy Schubert
1582b15cb3dSCy SchubertForce DNS resolution of following host names on the command line
1592b15cb3dSCy Schubertto the IPv6 namespace.
1602b15cb3dSCy Schubert@node ntpdc command
1612b15cb3dSCy Schubert@subsection command option (-c)
1622b15cb3dSCy Schubert@cindex ntpdc-command
1632b15cb3dSCy Schubert
1642b15cb3dSCy SchubertThis is the ``run a command and exit'' option.
1652b15cb3dSCy SchubertThis option takes a string argument @file{cmd}.
1662b15cb3dSCy Schubert
1672b15cb3dSCy Schubert@noindent
1682b15cb3dSCy SchubertThis option has some usage constraints.  It:
1692b15cb3dSCy Schubert@itemize @bullet
1702b15cb3dSCy Schubert@item
1712b15cb3dSCy Schubertmay appear an unlimited number of times.
1722b15cb3dSCy Schubert@end itemize
1732b15cb3dSCy Schubert
1742b15cb3dSCy SchubertThe following argument is interpreted as an interactive format command
1752b15cb3dSCy Schubertand is added to the list of commands to be executed on the specified
1762b15cb3dSCy Schuberthost(s).
1772b15cb3dSCy Schubert@node ntpdc interactive
1782b15cb3dSCy Schubert@subsection interactive option (-i)
1792b15cb3dSCy Schubert@cindex ntpdc-interactive
1802b15cb3dSCy Schubert
1812b15cb3dSCy SchubertThis is the ``force ntpq to operate in interactive mode'' option.
1822b15cb3dSCy Schubert
1832b15cb3dSCy Schubert@noindent
1842b15cb3dSCy SchubertThis option has some usage constraints.  It:
1852b15cb3dSCy Schubert@itemize @bullet
1862b15cb3dSCy Schubert@item
1872b15cb3dSCy Schubertmust not appear in combination with any of the following options:
1882b15cb3dSCy Schubertcommand, listpeers, peers, showpeers.
1892b15cb3dSCy Schubert@end itemize
1902b15cb3dSCy Schubert
1912b15cb3dSCy SchubertForce ntpq to operate in interactive mode.  Prompts will be written
1922b15cb3dSCy Schubertto the standard output and commands read from the standard input.
1932b15cb3dSCy Schubert@node ntpdc listpeers
1942b15cb3dSCy Schubert@subsection listpeers option (-l)
1952b15cb3dSCy Schubert@cindex ntpdc-listpeers
1962b15cb3dSCy Schubert
1972b15cb3dSCy SchubertThis is the ``print a list of the peers'' option.
1982b15cb3dSCy Schubert
1992b15cb3dSCy Schubert@noindent
2002b15cb3dSCy SchubertThis option has some usage constraints.  It:
2012b15cb3dSCy Schubert@itemize @bullet
2022b15cb3dSCy Schubert@item
2032b15cb3dSCy Schubertmust not appear in combination with any of the following options:
2042b15cb3dSCy Schubertcommand.
2052b15cb3dSCy Schubert@end itemize
2062b15cb3dSCy Schubert
2072b15cb3dSCy SchubertPrint a list of the peers known to the server as well as a summary of
2082b15cb3dSCy Schuberttheir state. This is equivalent to the 'listpeers' interactive command.
2092b15cb3dSCy Schubert@node ntpdc numeric
2102b15cb3dSCy Schubert@subsection numeric option (-n)
2112b15cb3dSCy Schubert@cindex ntpdc-numeric
2122b15cb3dSCy Schubert
2132b15cb3dSCy SchubertThis is the ``numeric host addresses'' option.
2142b15cb3dSCy SchubertOutput all host addresses in dotted-quad numeric format rather than
2152b15cb3dSCy Schubertconverting to the canonical host names.
2162b15cb3dSCy Schubert@node ntpdc peers
2172b15cb3dSCy Schubert@subsection peers option (-p)
2182b15cb3dSCy Schubert@cindex ntpdc-peers
2192b15cb3dSCy Schubert
2202b15cb3dSCy SchubertThis is the ``print a list of the peers'' option.
2212b15cb3dSCy Schubert
2222b15cb3dSCy Schubert@noindent
2232b15cb3dSCy SchubertThis option has some usage constraints.  It:
2242b15cb3dSCy Schubert@itemize @bullet
2252b15cb3dSCy Schubert@item
2262b15cb3dSCy Schubertmust not appear in combination with any of the following options:
2272b15cb3dSCy Schubertcommand.
2282b15cb3dSCy Schubert@end itemize
2292b15cb3dSCy Schubert
2302b15cb3dSCy SchubertPrint a list of the peers known to the server as well as a summary
2312b15cb3dSCy Schubertof their state. This is equivalent to the 'peers' interactive command.
2322b15cb3dSCy Schubert@node ntpdc showpeers
2332b15cb3dSCy Schubert@subsection showpeers option (-s)
2342b15cb3dSCy Schubert@cindex ntpdc-showpeers
2352b15cb3dSCy Schubert
2362b15cb3dSCy SchubertThis is the ``show a list of the peers'' option.
2372b15cb3dSCy Schubert
2382b15cb3dSCy Schubert@noindent
2392b15cb3dSCy SchubertThis option has some usage constraints.  It:
2402b15cb3dSCy Schubert@itemize @bullet
2412b15cb3dSCy Schubert@item
2422b15cb3dSCy Schubertmust not appear in combination with any of the following options:
2432b15cb3dSCy Schubertcommand.
2442b15cb3dSCy Schubert@end itemize
2452b15cb3dSCy Schubert
2462b15cb3dSCy SchubertPrint a list of the peers known to the server as well as a summary
2472b15cb3dSCy Schubertof their state. This is equivalent to the 'dmpeers' interactive command.
248a466cc55SCy Schubert@node ntpdc unconnected
249a466cc55SCy Schubert@subsection unconnected option (-u)
250a466cc55SCy Schubert@cindex ntpdc-unconnected
251a466cc55SCy Schubert
252a466cc55SCy SchubertThis is the ``use unconnected udp to communicate with ntpd (default on windows)'' option.
253a466cc55SCy SchubertOpen an unconnected UDP association to ntpd (the default
254a466cc55SCy Schuberton Windows).
2552b15cb3dSCy Schubert
2562b15cb3dSCy Schubert
2572b15cb3dSCy Schubert@node ntpdc config
2582b15cb3dSCy Schubert@subsection presetting/configuring ntpdc
2592b15cb3dSCy Schubert
2602b15cb3dSCy SchubertAny option that is not marked as @i{not presettable} may be preset by
2612b15cb3dSCy Schubertloading 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
2622b15cb3dSCy Schubertthe options listed above in upper case and segmented with underscores.
2632b15cb3dSCy SchubertThe @code{NTPDC} variable will be tokenized and parsed like
2642b15cb3dSCy Schubertthe command line.  The remaining variables are tested for existence and their
2652b15cb3dSCy Schubertvalues are treated like option arguments.
2662b15cb3dSCy Schubert
2672b15cb3dSCy Schubert
2682b15cb3dSCy Schubert@noindent
2692b15cb3dSCy Schubert@code{libopts} will search in 2 places for configuration files:
2702b15cb3dSCy Schubert@itemize @bullet
2712b15cb3dSCy Schubert@item
2722b15cb3dSCy Schubert$HOME
2732b15cb3dSCy Schubert@item
2742b15cb3dSCy Schubert$PWD
2752b15cb3dSCy Schubert@end itemize
2762b15cb3dSCy SchubertThe environment variables @code{HOME}, and @code{PWD}
2772b15cb3dSCy Schubertare expanded and replaced when @file{ntpdc} runs.
2782b15cb3dSCy SchubertFor any of these that are plain files, they are simply processed.
2792b15cb3dSCy SchubertFor any that are directories, then a file named @file{.ntprc} is searched for
2802b15cb3dSCy Schubertwithin that directory and processed.
2812b15cb3dSCy Schubert
2822b15cb3dSCy SchubertConfiguration files may be in a wide variety of formats.
2832b15cb3dSCy SchubertThe basic format is an option name followed by a value (argument) on the
2842b15cb3dSCy Schubertsame line.  Values may be separated from the option name with a colon,
2852b15cb3dSCy Schubertequal sign or simply white space.  Values may be continued across multiple
2862b15cb3dSCy Schubertlines by escaping the newline with a backslash.
2872b15cb3dSCy Schubert
2882b15cb3dSCy SchubertMultiple programs may also share the same initialization file.
2892b15cb3dSCy SchubertCommon options are collected at the top, followed by program specific
2902b15cb3dSCy Schubertsegments.  The segments are separated by lines like:
2912b15cb3dSCy Schubert@example
2922b15cb3dSCy Schubert[NTPDC]
2932b15cb3dSCy Schubert@end example
2942b15cb3dSCy Schubert@noindent
2952b15cb3dSCy Schubertor by
2962b15cb3dSCy Schubert@example
2972b15cb3dSCy Schubert<?program ntpdc>
2982b15cb3dSCy Schubert@end example
2992b15cb3dSCy Schubert@noindent
3002b15cb3dSCy SchubertDo not mix these styles within one configuration file.
3012b15cb3dSCy Schubert
3022b15cb3dSCy SchubertCompound values and carefully constructed string values may also be
3032b15cb3dSCy Schubertspecified using XML syntax:
3042b15cb3dSCy Schubert@example
3052b15cb3dSCy Schubert<option-name>
3062b15cb3dSCy Schubert   <sub-opt>...&lt;...&gt;...</sub-opt>
3072b15cb3dSCy Schubert</option-name>
3082b15cb3dSCy Schubert@end example
3092b15cb3dSCy Schubert@noindent
3102b15cb3dSCy Schubertyielding an @code{option-name.sub-opt} string value of
3112b15cb3dSCy Schubert@example
3122b15cb3dSCy Schubert"...<...>..."
3132b15cb3dSCy Schubert@end example
3142b15cb3dSCy Schubert@code{AutoOpts} does not track suboptions.  You simply note that it is a
3152b15cb3dSCy Schuberthierarchicly valued option.  @code{AutoOpts} does provide a means for searching
3162b15cb3dSCy Schubertthe associated name/value pair list (see: optionFindValue).
3172b15cb3dSCy Schubert
3182b15cb3dSCy SchubertThe command line options relating to configuration and/or usage help are:
3192b15cb3dSCy Schubert
3202b15cb3dSCy Schubert@subsubheading version (-)
3212b15cb3dSCy Schubert
3222b15cb3dSCy SchubertPrint the program version to standard out, optionally with licensing
3232b15cb3dSCy Schubertinformation, then exit 0.  The optional argument specifies how much licensing
324a466cc55SCy Schubertdetail to provide.  The default is to print just the version.  The licensing information may be selected with an option argument.
3252b15cb3dSCy SchubertOnly the first letter of the argument is examined:
3262b15cb3dSCy Schubert
3272b15cb3dSCy Schubert@table @samp
3282b15cb3dSCy Schubert@item version
3292b15cb3dSCy SchubertOnly print the version.  This is the default.
3302b15cb3dSCy Schubert@item copyright
3312b15cb3dSCy SchubertName the copyright usage licensing terms.
3322b15cb3dSCy Schubert@item verbose
3332b15cb3dSCy SchubertPrint the full copyright usage licensing terms.
3342b15cb3dSCy Schubert@end table
3352b15cb3dSCy Schubert
3362b15cb3dSCy Schubert@node ntpdc exit status
3372b15cb3dSCy Schubert@subsection ntpdc exit status
3382b15cb3dSCy Schubert
3392b15cb3dSCy SchubertOne of the following exit values will be returned:
3402b15cb3dSCy Schubert@table @samp
3412b15cb3dSCy Schubert@item 0 (EXIT_SUCCESS)
3422b15cb3dSCy SchubertSuccessful program execution.
3432b15cb3dSCy Schubert@item 1 (EXIT_FAILURE)
3442b15cb3dSCy SchubertThe operation failed or the command syntax was not valid.
3452b15cb3dSCy Schubert@item 66 (EX_NOINPUT)
3462b15cb3dSCy SchubertA specified configuration file could not be loaded.
3472b15cb3dSCy Schubert@item 70 (EX_SOFTWARE)
3482b15cb3dSCy Schubertlibopts had an internal operational error.  Please report
3492b15cb3dSCy Schubertit to autogen-users@@lists.sourceforge.net.  Thank you.
3502b15cb3dSCy Schubert@end table
3512b15cb3dSCy Schubert@node ntpdc Usage
3522b15cb3dSCy Schubert@subsection ntpdc Usage
3532b15cb3dSCy Schubert@node ntpdc See Also
3542b15cb3dSCy Schubert@subsection ntpdc See Also
3552b15cb3dSCy Schubert@node ntpdc Authors
3562b15cb3dSCy Schubert@subsection ntpdc Authors
3572b15cb3dSCy Schubert@node ntpdc Bugs
3582b15cb3dSCy Schubert@subsection ntpdc Bugs
359