components/ntp/manpages/ntpdate.1m
changeset 172 093198acf7d4
child 181 87e11e685b1f
equal deleted inserted replaced
171:dbff1afe6b31 172:093198acf7d4
       
     1 '\" te
       
     2 .\" CDDL HEADER START
       
     3 .\"
       
     4 .\" The contents of this file are subject to the terms of the
       
     5 .\" Common Development and Distribution License (the "License").
       
     6 .\" You may not use this file except in compliance with the License.
       
     7 .\"
       
     8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 .\" or http://www.opensolaris.org/os/licensing.
       
    10 .\" See the License for the specific language governing permissions
       
    11 .\" and limitations under the License.
       
    12 .\"
       
    13 .\" When distributing Covered Code, include this CDDL HEADER in each
       
    14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 .\" If applicable, add the following below this CDDL HEADER, with the
       
    16 .\" fields enclosed by brackets "[]" replaced with your own identifying
       
    17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 .\"
       
    19 .\" CDDL HEADER END
       
    20 .\"
       
    21 .\" Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
       
    22 .\"
       
    23 .TH "ntpdate" "1M" "" "" "System Administration Commands"
       
    24 .SH NAME
       
    25 ntpdate \- set the date and time with NTP
       
    26 .SH SYNOPSIS
       
    27 .LP
       
    28 .B /usr/sbin/ntpdate
       
    29 [\fB-46bBdqsuv\fR] [\fB-a\fR \fIkey\fR] [\fB-e\fR \fIAuthdelay\fR] [\fB-k\fR \fIkeyfile\fR] [\fB-o\fR \fIversion\fR] [\fB-p\fR \fIsamples\fR] [\fB-t\fR \fItimeout\fR] \fIserver\fR [ ... ]
       
    30 .SH "OPTIONS"
       
    31 .TP
       
    32 .BR "-4"
       
    33 Force DNS resolution of following host names on the command line to the IPv4 namespace.
       
    34 .TP
       
    35 .BR "-6"
       
    36 Force DNS resolution of following host names on the command line to the IPv6 namespace.
       
    37 .TP
       
    38 .BR "-a \fIkey\fP"
       
    39 Enable authentication and specify the key identifier to be used for authentication as the argument \fIkey\fR. The keys and key identifiers must match in both the client and server key files. The default is to disable authentication.
       
    40 .TP
       
    41 .BR "-B"
       
    42 Force the time to always be slewed using the adjtime() system call, even if the measured offset is greater than 0.5 seconds. The default is to step the time using settimeofday() if the offset is greater than +-0.5s. Note that, if the offset is much greater than +-0.5s in this case, that it can take a long time (hours) to slew the clock to the correct value. During this time, the host should not be used to synchronize clients.
       
    43 .TP
       
    44 .BR "-b"
       
    45 Force the time to be stepped using the settimeofday() system call, rather than slewed (default) using the adjtime() system call. This option should be used when called from a startup file at boot time.
       
    46 .TP
       
    47 .BR "-d "
       
    48 Enable the debugging mode, in which \fBntpdate\fR will go through all the steps, but not adjust the local clock. Information useful for general debugging will also be printed.
       
    49 .TP
       
    50 .BR "-e \fIauthdelay\fP"
       
    51 Specify the processing delay to perform an authentication function as the value \fIauthdelay\fR, in seconds and fraction (see \fBntpd\fR for details). This number is usually small enough to be negligible for most purposes, though specifying a value may improve timekeeping on very slow CPU's.
       
    52 .TP
       
    53 .BR "-k \fIkeyfile\fP"
       
    54 Specify the path for the authentication key file as the string \fIkeyfile\fR. The default is \fB/etc/inet/ntp.keys\fR. This file should be in the format described in \fBntpd\fR.
       
    55 .TP
       
    56 .BR "-o \fIversion\fP"
       
    57 Specify the NTP version for outgoing packets as the integer \fIversion\fR, which can be 1 or 2. The default is 3. This allows \fBntpdate\fR to be used with older NTP versions.
       
    58 .TP
       
    59 .BR "-p \fIsamples\fP"
       
    60 Specify the number of samples to be acquired from each server as the integer \fIsamples\fR, with values from 1 to 8 inclusive. The default is 4.
       
    61 .TP
       
    62 .BR "-q"
       
    63 Query only - don't set the clock.
       
    64 .TP
       
    65 .BR "-s"
       
    66 Divert logging output from the standard output (default) to the system \fBsyslog\fR facility.
       
    67 .TP
       
    68 .BR "-t \fItimeout\fP"
       
    69 Specify the maximum time waiting for a server response as the value \fItimeout\fR, in seconds and fraction. The value is is rounded to a multiple of 0.2 seconds. The default is 1 second, a value suitable for polling across a LAN.
       
    70 .TP
       
    71 .BR "-u"
       
    72 Direct \fBntpdate\fR to use an unprivileged port or outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronise with hosts beyond the firewall. Note that the \fB-d\fR option always uses unprivileged ports.
       
    73 .TP
       
    74 .BR "-v"
       
    75 Print \fBntpdate\fR's version identification string during program startup.
       
    76 .SH "DESCRIPTION"
       
    77 \fBntpdate\fR sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the \fIserver\fR arguments to determine the correct time. It must be run as root unless the \fB-d\fR or \fB-q\fR options are used. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of \fBntpdate\fR depends on the number of servers, the number of polls each time it is run and the interval between runs.
       
    78 .LP
       
    79 \fBntpdate\fR can be run manually as necessary to set the host clock, or it can be run from the host startup script to set the clock at boot time. It is also possible to run \fBntpdate\fR from a \fBcron\fR script. However, it is important to note that \fBntpdate\fR with contrived \fBcron\fR scripts is no substitute for the NTP daemon, which uses sophisticated algorithms to maximize accuracy and reliability while minimizing resource use. Finally, since \fBntpdate\fR does not discipline the host clock frequency as does \fBntpd\fR, the accuracy using \fBntpdate\fR is limited.
       
    80 .LP
       
    81 Time adjustments are made by \fBntpdate\fR in one of two ways. If \fBntpdate\fR determines the clock is in error more than 0.5 second it will simply step the time by calling the system \fBsettimeofday()\fR routine. If the error is less than 0.5 seconds, it will slew the time by calling the system \fBadjtime()\fR routine. The latter technique is less disruptive and more accurate when the error is small, and works quite well when \fBntpdate\fR is run by \fBcron\fR every hour or two.
       
    82 \fBntpdate\fR will decline to set the date if an NTP server daemon (e.g., \fBntpd\fR) is running on the same host. When running \fBntpdate\fR on a regular basis from \fBcron\fR as an alternative to running a daemon, doing so once every hour or two will result in precise enough timekeeping to avoid stepping the clock.
       
    83 Note that in contexts where a host name is expected, a \fB-4\fR qualifier preceding the host name forces DNS resolution to the IPv4 namespace, while a \fB-6\fR qualifier forces DNS resolution to the IPv6 namespace.
       
    84 .SH ATTRIBUTES
       
    85 See
       
    86 .BR attributes (5)
       
    87 for descriptions of the following attributes:
       
    88 .sp
       
    89 .TS
       
    90 box;
       
    91 cbp-1 | cbp-1
       
    92 l | l .
       
    93 ATTRIBUTE TYPE	ATTRIBUTE VALUE
       
    94 =
       
    95 Availability	service/network/ntp
       
    96 =
       
    97 Interface Stability	Uncommitted Obsolete
       
    98 .TE 
       
    99 .PP
       
   100 .SH NOTES
       
   101 Source for ntpdate is available on http://src.opensolaris.org.
       
   102 .LP
       
   103 Disclaimer: The functionality of this program is now available in the \fBntpd\fB program. See the \fB-q\fB command line option in the \fBntpd\fB - Network Time Protocol (NTP) daemon man page. After a suitable period, the \fBntpdate\fB program is to be retired from this distribution
       
   104 .TE
       
   105 .PP
       
   106 .SH SEE ALSO
       
   107 .LP
       
   108 \fBntpd\fR(1M), \fBntpdc\fR(1M), \fBattributes\fR(5)