⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sntp.1

📁 网络时间协议NTP 源码 版本v4.2.0b 该源码用于linux平台下
💻 1
字号:
.TH SNTP 1.SH NAMEsntp \- a SNTP utility (command and daemon).SH SYNOPSIS.B sntp[.B \-h|.B \-\-help|.B \-?] [.B \-v|.B \-V|.B \-W] [.B \-q[.BI \-f " savefile"] | [ {.B \-r|.B \-a} [.BI \-P " prompt"] [.BI \-l " lockfile"] ] [.BI \-e " minerr"] [.BI \-E " maxerr"] [.BI \-c " count"] [.BI \-d " delay"|.B \-x[.I separation] ] [.BI \-f " savefile"] ] [.B \-4] | [.B \-6] [.I address(es)] ].SH DESCRIPTION.PP.I sntpcan be used as a SNTP client to query a NTP or SNTP server and either displaythe time or set the local system's time (given suitable privilege).  It can berun as an interactive command, in a.I cronjob or as a daemon.  It can be run as a daemon to provide a SNTP server forother clients.  NTP is the Network Time Protocol (RFC 1305) and SNTP is theSimple Network Time Protocol (RFC 2030, which supersedes RFC 1769)..SS Options.PP.I sntprecognizes the following options:.TP.B \-hdisplays the syntax error message.  If there are no other arguments, it thenstops; otherwise it then does what was requested..B \-\-helpand.B \-?are synonyms..TP.B \-vindicates that diagnostic messages for non-fatal errors and a limited amount oftracing should be written to standard error.  Fatal ones always produce adiagnostic.  This option should be set when there is a suspected problem withthe server, network or the source..TP.B \-Vrequests more and less comprehensible output, mainly for investigating problemswith apparently inconsistent timestamps.  This option should be set when theprogram fails with a message indicating that is the trouble..TP.B \-Wrequests very verbose debugging output, and will interfere with the timingwhen writing to the terminal (because of line buffered output from C).  Notethat the times produced by this are the corrections needed, and not the errorin the local clock.  This option should be set only when debugging the source..TP.B \-qindicates that it should query a daemon save file being maintained by it.This needs no privilege and will change neither the save file nor the clock..PPThe default is that it should behave as a client, and the following optionsare then relevant:.TP.B \-rindicates that the system clock should be reset by.IR settimeofday .Naturally, this will work only if the user has enough privilege..TP.B \-aindicates that the system clock should be reset by.IR adjtime .Naturally, this will work only if the user has enough privilege..PPThe default is to write the estimated correct local date and time (i.e. notUTC) to the standard output in a format like.BR "'1996 Oct 15 20:17:25.123 + 4.567 +/- 0.089 secs'" ,where the.B "'+ 4.567 +/- 0.089 secs'"indicates the estimated error in the time on the local system.  In daemon mode,it will add drift information in a format like.BR "' + 1.3 +/- 0.1 ppm'" ,and display this at roughly.I separationintervals (see under the.B \-xoption for details)..TP.BI \-l " lockfile"sets the name of the lock file to ensure that there is onlyone copy of.I sntprunning at once.  The default is installation-dependent, but will usually be.IR /etc/sntp.pid ..TP.BI \-e " minerr"sets the maximum ignorable variation between the clocks to.IR minerr .Acceptable values are from 0.001 to 1, and the default is 0.1 if a NTP host isis specified and 0.5 otherwise..TP.BI \-E " maxerr"sets the maximum value of various delays that are deemed acceptable to.IR maxerr .Acceptable values are from 1 to 60, and the default is 5.  It should sometimesbe increased if there are problems with the network, NTP server or systemclock, but take care..TP.BI \-P  " prompt"sets the maximum clock change that will be made automatically to.IR maxerr .Acceptable values are from 1 to 3600 or.IR no ,and the default is 30.  If the program is being run interactively in ordinaryclient mode, and the system clock is to be changed, larger corrections willprompt the user for confirmation.  Specifying.I nowill disable this and the correction will be made regardless..TP.BI \-c " count"sets the maximum number of NTP packets required to.IR count .Acceptable values are from 1 to 25 if a NTP host is specified and from 5 to 25otherwise, and the default is 5.  If the maximum isn't enough, the system needsa better consistency algorithm than this program uses..TP.BI \-d " delay"sets a rough limit on the total running time to.I delayseconds.  Acceptable values are from 1 to 3600, and the default is 15 if a NTPhost is specified and 300 otherwise..TP.BI \-x " separation"causes the program to run as a daemon (i.e. forever), and to estimate and correct for the clock drift..I separationsets the minimum time between calls to the server in minutes if a NTP host isspecified, and between broadcast packets if not.  Acceptable values are from 1to 1440 (a day), and the default (if.B \-xis specified but.I separationis omitted) is 300..TP.BI \-f " savefile"may be used with the.B \-xoption to store a record of previous packets, which speeds up recalculatingthe drift after.I sntphas to be restarted (e.g. because of network or server outages).  In order torestart the data,.I sntpmust be restarted reasonably soon after it died (within a few times the value of.IR separation ),with the same value of the.B \-coption, the same value of.IR separation ,in the same mode (i.e. broadcast or client), though the NTP servers need notbe the same for client mode, and with compatible values of other settings.Note that the file will be created with the default ownerships and permissions,using standard C facilities.  The default is installation-dependent, but willusually be.IR /etc/sntp.state ..TP.B -4force IPv4 DNS resolution..TP.B -6force IPv6 DNS resolution..PP.B address(es)are the DNS names or IP numbers of hosts to use for the challenge and responseprotocol; if no names are given, the program waits for broadcasts.  Polling aserver is vastly more reliable than listening to broadcasts.  Note that asingle component numeric address is not allowed, to avoid ambiguities.  Ifmore than one name is give, they will be used in a round-robin fashion..PPConstraints:.IP.B minerrmust be less than.B maxerrwhich must be less than.B delay(or, if a NTP host is not specified.BR delay / count "),"and.B countmust be less than half of.BR delay ..IPIn update mode,.B maxerrmust be less than.BR prompt..IPIn daemon mode (i.e. when.B \-xis specified),.B minerrmust be less than.B maxerrwhich must be less than.B separation(note that this is in minutes, not seconds, but the numeric value is compared)..PPNote that none of the above values are closely linked to the limits describedin the NTP protocol (RFC 1305)..SH USAGEThe simplest use of this program is as an unprivileged command to check thecurrent time and error in the local clock.  For example:.IP.B sntp ntpserver.somewhere.PPIt can be run as a unprivileged background process to check on the clock driftas well as the current error; this will probably fail if the local clock isreset while it is running.  For example:.IP.B sntp -x ntpserver.somewhere > output 2>\&1 \&.PPWith suitable privilege, it can be run as a command or in a.I cronjob to reset the local clock from a reliable server, like the.I ntpdateand.I rdatecommands.  For example:.IP.B sntp -a ntpserver.somewhere.PPIt can also be run as a daemon to keep the local clock in step.  For example:.IP.B sntp -a -x ntpserver.somewhere > output 2>\&1 \&.PPMore information on how to use this utility is given in the.I READMEfile in the distribution.  In particular, this.I manpage does not describe how to set it up as a server, which needs special careto avoid propagating misinformation..SH RETURN VALUEWhen used as a client in non-daemon mode, the program returns a zero exitstatus for success, and a non-zero one otherwise. When used as a daemon(either client or server), it does not return except after a serious error..SH BUGSThe program implements the SNTP protocol, and does not provide all NTP facilities.  In particular, it contains no checks against any form of spoofing.If this is a serious concern, some network security mechanism (like a firewallor even just.IR tcpwrappers )should be installed..PPThere are some errors, ambiguities and inconsistencies in the RFCs, and thiscode may not interwork with all other NTP implementations.  Any unreasonablerestrictions should be reported as bugs to whoever is responsible.  It maybe difficult to find out who that is..PPThe program will stop as soon as it feels that things have got out of control.In client daemon mode, it will usually fail during an extended period ofnetwork or server inaccessibility or excessively slow performance, or when thelocal clock is reset by another process.  It will then need restartingmanually.  Experienced system administrators can write a shell script, a.I cronjob or put it in.IR inittab ,to do this automatically..PPThe error cannot be estimated reliably with broadcast packets or for the driftin daemon mode (even with client-server packets), and the guess made by theprogram may be wrong (possibly even very wrong).  If this is a problem, thensetting the.B \-coption to a larger value may help.  Or it may not..SH AUTHOR.I sntpwas developed by N.M. Maclaren of the University of Cambridge ComputingService.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -