Home | History | Annotate | Line # | Download | only in sntp
sntp.1sntpmdoc revision 1.1.1.1.8.2
      1 .Dd December 24 2013
      2 .Dt SNTP 1sntpmdoc User Commands
      3 .Os SunOS 5.10
      4 .\"  EDIT THIS FILE WITH CAUTION  (sntp-opts.mdoc)
      5 .\"
      6 .\"  It has been AutoGen-ed  December 24, 2013 at 11:40:02 AM by AutoGen 5.18.3pre5
      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.
    137 .It  Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name 
    138 Look in this file for the key specified with \fB\-a\fP.
    139 .sp
    140 This option specifies the keyfile.
    141 \fBsntp\fP will search for the key specified with \fB\-a\fP
    142 \fIkeyno\fP in this file.  See \fBntp.keys(5)\fP for more
    143 information.
    144 .It  Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name 
    145 Log to specified logfile.
    146 .sp
    147 This option causes the client to write log messages to the specified
    148 \fIlogfile\fP.
    149 .It  Fl M Ar number , Fl \-steplimit Ns = Ns Ar number 
    150 Adjustments less than \fBsteplimit\fP msec will be slewed.
    151 This option takes an integer number as its argument.
    152 The value of
    153 .Ar number
    154 is constrained to being:
    155 .in +4
    156 .nf
    157 .na
    158 greater than or equal to 0
    159 .fi
    160 .in -4
    161 .sp
    162 If the time adjustment is less than \fIsteplimit\fP milliseconds,
    163 slew the amount using \fBadjtime(2)\fP.  Otherwise, step the
    164 correction using \fBsettimeofday(2)\fP. 
    165 .It  Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number 
    166 Send \fBint\fP as our NTP protocol version.
    167 This option takes an integer number as its argument.
    168 The value of
    169 .Ar number
    170 is constrained to being:
    171 .in +4
    172 .nf
    173 .na
    174 in the range  0 through 7
    175 .fi
    176 .in -4
    177 The default
    178 .Ar number
    179 for this option is:
    180 .ti +4
    181  4
    182 .sp
    183 When sending requests to a remote server, tell them we are running
    184 NTP protocol version \fIntpversion\fP .
    185 .It  Fl r , Fl \-usereservedport 
    186 Use the NTP Reserved Port (port 123).
    187 .sp
    188 Use port 123, which is reserved for NTP, for our network
    189 communications.
    190 .It  Fl S , Fl \-step 
    191 OK to 'step' the time with \fBsettimeofday(2)\fP.
    192 .sp
    193 .It  Fl s , Fl \-slew 
    194 OK to 'slew' the time with \fBadjtime(2)\fP.
    195 .sp
    196 .It  Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds 
    197 The number of seconds to wait for responses.
    198 This option takes an integer number as its argument.
    199 The default
    200 .Ar seconds
    201 for this option is:
    202 .ti +4
    203  5
    204 .sp
    205 When waiting for a reply, \fBsntp\fP will wait the number
    206 of seconds specified before giving up.  The default should be
    207 more than enough for a unicast response.  If \fBsntp\fP is
    208 only waiting for a broadcast response a longer timeout is
    209 likely needed.
    210 .It  Fl \-wait , " Fl \-no\-wait"
    211 Wait for pending replies (if not setting the time).
    212 The \fIno\-wait\fP form will disable the option.
    213 This option is enabled by default.
    214 .sp
    215 If we are not setting the time, wait for all pending responses.
    216 .It Fl \&? , Fl \-help
    217 Display usage information and exit.
    218 .It Fl \&! , Fl \-more\-help
    219 Pass the extended usage information through a pager.
    220 .It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
    221 Save the option state to \fIcfgfile\fP.  The default is the \fIlast\fP
    222 configuration file listed in the \fBOPTION PRESETS\fP section, below.
    223 The command will exit after updating the config file.
    224 .It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
    225 Load options from \fIcfgfile\fP.
    226 The \fIno\-load\-opts\fP form will disable the loading
    227 of earlier config/rc/ini files.  \fI\-\-no\-load\-opts\fP is handled early,
    228 out of order.
    229 .It Fl \-version Op Brq Ar v|c|n
    230 Output version of program and exit.  The default mode is `v', a simple
    231 version.  The `c' mode will print copyright information and `n' will
    232 print the full copyright notice.
    233 .El
    234 .Sh "OPTION PRESETS"
    235 Any option that is not marked as \fInot presettable\fP may be preset
    236 by loading values from configuration ("RC" or ".INI") file(s) and values from
    237 environment variables named:
    238 .nf
    239   \fBSNTP_<option\-name>\fP or \fBSNTP\fP
    240 .fi
    241 .ad
    242 The environmental presets take precedence (are processed later than)
    243 the configuration files.
    244 The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
    245 If any of these are directories, then the file \fI.ntprc\fP
    246 is searched for within those directories.
    247 cvt_prog='/usr/local/gnu/share/autogen/texi2mdoc'
    248 cvt_prog=`cd \`dirname "$cvt_prog"\` >/dev/null && pwd
    249          `/`basename "$cvt_prog"`
    250 cd $tmp_dir
    251 test \-x "$cvt_prog" || die "'$cvt_prog' is not executable"
    252 {
    253     list='synopsis description options option\-presets'
    254     for f in $list ; do cat $f ; echo ; done
    255     rm \-f $list name
    256     list='implementation\-notes environment files examples exit\-status errors
    257         compatibility see\-also conforming\-to history authors copyright bugs
    258         notes'
    259     for f in $list ; do cat $f ; echo ; done > .end\-doc
    260     rm \-f $list
    261     list=`ls \-1 *`' .end\-doc'
    262     for f in $list ; do cat $f ; echo ; done
    263     rm \-f $list
    264 } 1>.doc 2>/dev/null
    265 sed \-f .cmds .doc | /usr/local/gnu/bin/grep \-E \-v '^[ 	]*$' | $cvt_prog
    266 .Sh USAGE
    267 .Bl -tag -width indent
    268 .It Li "sntp ntpserver.somewhere"
    269 is the simplest use of this program
    270 and can be run as an unprivileged command
    271 to check the current time and error in the local clock.
    272 .It Li "sntp \-a ntpserver.somewhere"
    273 With suitable privilege,
    274 run as a command
    275 or from a
    276 .Xr cron 8
    277 job,
    278 .Ic "sntp \-a"
    279 will reset the local clock from a synchronized specified server,
    280 like the (deprecated)
    281 .Xr ntpdate 1ntpdatemdoc ,
    282 or
    283 .Xr rdate 8
    284 commands.
    285 .El
    286 .Sh "ENVIRONMENT"
    287 See \fBOPTION PRESETS\fP for configuration environment variables.
    288 .Sh "FILES"
    289 See \fBOPTION PRESETS\fP for configuration files.
    290 .Sh "EXIT STATUS"
    291 One of the following exit values will be returned:
    292 .Bl -tag
    293 .It 0 " (EXIT_SUCCESS)"
    294 Successful program execution.
    295 .It 1 " (EXIT_FAILURE)"
    296 The operation failed or the command syntax was not valid.
    297 .It 66 " (EX_NOINPUT)"
    298 A specified configuration file could not be loaded.
    299 .It 70 " (EX_SOFTWARE)"
    300 libopts had an internal operational error.  Please report
    301 it to autogen\-users (a] lists.sourceforge.net.  Thank you.
    302 .El
    303 .Sh AUTHORS
    304 .An "Johannes Maximilian Kuehn"
    305 .An "Harlan Stenn"
    306 .An "Dave Hart"
    307 .Sh "COPYRIGHT"
    308 Copyright (C) 1970\-2013 The University of Delaware all rights reserved.
    309 This program is released under the terms of the NTP license, <http://ntp.org/license>.
    310 .Sh "BUGS"
    311 Please send bug reports to: http://bugs.ntp.org, bugs (a] ntp.org
    312 .Sh NOTES
    313 This document corresponds to version 4.2.7p404 of
    314 .Nm .
    315 .Pp
    316 This manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP
    317 option definitions.
    318