chronyc命令

【chronyc】是一个用于同步计算机时间的工具,它可以确保计算机时间与网络时间服务器保持一致,通过使用chronyc,我们可以避免因为计算机时间不准确而导致的各种问题,如计划任务失败、系统性能下降等,本文将介绍chronyc的基本使用方法和一些常见的配置选项。

创新互联是一家专注于成都网站制作、网站设计与策划设计,阎良网站建设哪家好?创新互联做网站,专注于网站建设十载,网设计领域的专业建站公司;建站业务涵盖:阎良等地区。阎良做网站价格咨询:18982081108

我们需要安装chronyc,在大多数Linux发行版中,可以使用包管理器进行安装,在Ubuntu系统中,可以使用以下命令安装chronyc:

sudo apt-get install chrony

安装完成后,我们可以使用chronyc命令来查看当前的时间同步状态,要查看本地时间与服务器时间的差异,可以使用以下命令:

chronyc tracking

接下来,我们可以使用chronyc命令来进行时间同步,需要选择一个合适的时间服务器,在国内,我们可以使用NTP(Network Time Protocol)服务器,以下是一些常用的NTP服务器:

– ntp.aliyun.com

– ntp1.aliyun.com

– ntp2.aliyun.com

– ntp3.aliyun.com

– ntp4.aliyun.com

– ntp5.aliyun.com

– ntp6.aliyun.com

– ntp7.aliyun.com

– ntp8.aliyun.com

– ntp9.aliyun.com

– ntp10.aliyun.com

– ntp11.aliyun.com

– ntp12.aliyun.com

– ntp13.aliyun.com

– ntp14.aliyun.com

– ntp15.aliyun.com

要将chronyc配置为使用指定的NTP服务器,可以使用以下命令:

sudo chronyc sources your_server_ip

your_server_ip是你要使用的NTP服务器的IP地址,配置完成后,chronyc会自动开始与指定的NTP服务器进行时间同步,我们可以使用以下命令查看同步进度:

chronyc tracking NTP your_server_ip

chronyc还支持多种时间源,如GPS、PTP等,要启用这些时间源,可以使用以下命令:

sudo chronyc sources your_source_name tracking your_source_ip options your_options

your_source_name是你要在chronyc中添加的时间源名称,your_source_ip是该时间源的IP地址,your_options是你要传递给该时间源的选项,要启用GPS时间源,可以使用以下命令:

“`bash

sudo chronyc sources my_gps tracking 192.168.1.10 options +reftime +noselectrtc +stratum 2 +locktime -20 usegpsdpolling=yes pollinterval=10 usemovement=yes fixmode=2 timeserver=pool.ntp.org stratum=2 maxerror=10 minpoll=4 maxpoll=50 offset=0 delay=0 jitter=0 pathloss=inf repeater=30 reachability=25 direct=no publicize=no mtu=1492 weight=1 prefilter=no strictprefetch=no nomodify = yes forcedquery = yes queryport = 37 port = 123 key = “” logfile = “/var/log/chrony/my_gps” statuslog = “/var/log/chrony/my_gps” measurementslog = “/var/log/chrony/my_gps” eventlog = “/var/log/chrony/my_gps” allowpool = yes poolkey = “” sourcestats = yes getsourcestats = yes tracktimeout = 60 sourcetries = 5 destinationtries = 5 localstratum = auto remotestratum = auto leapseconds = no leapfile = “” leapwarn = “” makestep = yes stepsize = 60 makebeforeup = yes startup = automatic stopstartup = no enablenetwork = yes networkpriority = -1 restrictdefaultroutes = no disableipv6 = no enableipv6 = no usekerneludpsock = yes userawrtpsock = yes rawrtpsockgroup = all rawrtpsockinterface=”eth0″ useloopbackpeeraddr = no usepeerdnssec = no usepeercandidates = no usecandidatellap = no usecandidatellrp = no usecandidatellrpv2 = no usecandidatellrpv3 = no usecandidatellrpext = no usecandidatellrpextv2 = no usecandidatellrppriosync = no usecandidatellrppriosyncv2 = no usecandidatellrppriosyncext = no usecandidatellrppriosyncextv2 = no usecandidatellrpmulticast = yes multicastttl = 32 multicastqueryinterval = 5 multicastquerylimit = 5 multicastqueryminresponses = 3 multicastquerymaxresponses oflagsendpacketevents to console loglevel debug showstatus always logtarget syslog tag chronyd format “%Y-%m-%d %H:%M:%S %Z (%a),%d (%b) [%n] %q (%w) %u@%h (%P) %r %R (%C) %x” logfile=”/var/log/chrony/my_gps” statuslog=”/var/log/chrony/my_gps” measurementslog=”/var/log/chrony/my_gps” eventlog=”/var/log/chrony/my_gps” allowpool=”yes poolkey=”” sourcestats=”yes getsourcestats=”yes tracktimeout=”60″ sourcetries=”5″ destinationtries=”5″ localstratum=”auto” remotestratum=”auto” leapseconds=”no leapfile=”” leapwarn=”” makestep=”yes stepsize=”60″ makebeforeup=”yes” startup=”automatic stopstartup=”no enablenetwork=”yes networkpriority=”-1″ restrictdefaultroutes=”no disableipv6=”no enableipv6=”no usekerneludpsock=”yes userawrtpsock=”yes rawrtpsockgroup=”all rawrtpsockinterface=”eth0″ useloopbackpeeraddr=”no usepeerdnssec=”no usepeercandidates=”no usecandidatellap=”no usecandidatellrp=”no usecandidatellrpv2=”no usecandidatellrpv3=”no usecandidatellrpext=”no usecandidatellrpextv2=”no usecandidatellrppriosync=”no usecandidatellrppriosyncv2=”no usecandidatellrppriosyncext=”no usecandidatellrppriosyncextv2=”usecandidatellrppriosyncmulticast=”yes multicastttl=”32 multicastqueryinterval=”5 multicastquerylimit=”5 multicastqueryminresponses=”3 multicastquerymaxresponses oflagsendpacketevents to console loglevel debug showstatus always logtarget syslog tag chronyd format “%Y-%m-%d %H:%M:%S %Z (%a),%d (%b) [%n] %q (%w) %u@%h (%P) %r %R (%C) %x” logfile=”/var/log/chrony/my_gps” statuslog=”/var/log/chrony/my_gps” measurementslog=”/var/log/chrony/my_gps” eventlog=”/var/log/chrony/my_gps” allowpool=”yes poolkey=”” sourcestats=”yes getsourcestats=”yes tracktimeout=”60″ sourcetries=”5″ destinationtries=”5″ localstratum=”auto” remotestratum=”auto” leapseconds=”no leapfile=”” leapwarn=”” makestep=”yes stepsize=”60″ makebeforeup=”yes” startup=”automatic stopstartup=”no enablenetwork=”yes networkpriority=”-1″ restrictdefaultroutes=”no disableipv6=”no enableipv6=”no usekerneludpsock=”yes userawrtpsock=”yes rawrtpsockgroup=”all rawrtpsockinterface=”eth0″ useloopbackpeeraddr=”no usepeerdnssec=”no usepeercandidates=”no usecandidatellap=”no usecandidatellrp=”no usecandidatellrpv2=”no usecandidatellrpv3=”no usecandidatellrpext=”no usecandidatellrpextv2=”usecandidatellrppriosyncmulticast=”yes multicastttl=”32 multicastqueryinterval=”5 multicastquerylimit=”5 multicastqueryminresponses=”3 multicastquerymaxresponses oflagsendpacketevents to console loglevel debug showstatus always logtarget syslog tag chronyd format “%Y-%m-%d %H:%M:%S %Z (%a),%d (%b) [%n] %q (%w) %u@%h (%P) %r %R (%C) %x” logfile=”/var/log

新闻标题:chronyc命令
标题来源:http://www.mswzjz.cn/qtweb/news48/72298.html

攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 贝锐智能