动态查看时间的命令

watch -n 1 "date +%T"

ntp命令

查看时间同步源:

$ chronyc sources -v

查看时间同步源状态:

$ chronyc sourcestats -v

设置硬件时间

硬件时间默认为UTC:

$ timedatectl set-local-rtc 1

启用NTP时间同步:

$ timedatectl set-ntp yes

校准时间服务器:

$ chronyc tracking

timedatectl set-time "YYYY-MM-DD HH:MM:SS" //设置时间和日期

chrony.conf配置文件内容介绍

$ cat /etc/chrony.conf

# 使用pool.ntp.org项目中的公共服务器。以server开,理论上你想添加多少时间服务器都可以。
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst # 根据实际时间计算出服务器增减时间的比率,然后记录到一个文件中,在系统重启后为系统做出最佳时间补偿调整。
driftfile /var/lib/chrony/drift # chronyd根据需求减慢或加速时间调整,
# 在某些情况下系统时钟可能漂移过快,导致时间调整用时过长。
# 该指令强制chronyd调整时期,大于某个阀值时步进调整系统时钟。
# 只有在因chronyd启动时间超过指定的限制时(可使用负值来禁用限制)没有更多时钟更新时才生效。
makestep 1.0 3 # 将启用一个内核模式,在该模式中,系统时间每11分钟会拷贝到实时时钟(RTC)。
rtcsync # Enable hardware timestamping on all interfaces that support it.
# 通过使用hwtimestamp指令启用硬件时间戳
#hwtimestamp eth0
#hwtimestamp eth1
#hwtimestamp * # Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2 # 指定一台主机、子网,或者网络以允许或拒绝NTP连接到扮演时钟服务器的机器
#allow 192.168.0.0/16
#deny 192.168/16

#即使自己未能通过网络时间服务器同步到时间,也允许将本地时间作为标准时间授时给其它客户端(内网环境下一定要注释此项);
# Serve time even if not synchronized to a time source.
local stratum 10 # 指定包含NTP验证密钥的文件。
#keyfile /etc/chrony.keys # 指定日志文件的目录,经过我多次测试在centos7上,实际上这个目录是空的,不知道为啥,请各位大神留言交流一下。
logdir /var/log/chrony # Select which information is logged.
#log measurements statistics tracking

chrony配置的和相关命令的更多相关文章

  1. sqlplus 配置方法及相关命令

    sqlplus 配置方法及相关命令 1.配置文件 1.1 全局模式什么叫全局模式呢:当我们配置完sqlplus工具加载配置文件后,无论在哪个目录下登陆数据库,您设置[sqlplus提示符样子,在任何目 ...

  2. Linux网络——配置防火墙的相关命令

    Linux网络——配置防火墙的相关命令 摘要:本文主要学习了如何在Linux系统中配置防火墙. iptables命令 iptables准确来讲并不是防火墙,真正的防火墙是运行于系统内核中的netfil ...

  3. linux网络配置相关命令、虚拟网络接口eth0:0

    网络接口(interface)是网络硬件设备在操作系统中的表示方法,比如网卡在Linux操作系统中用ethX,是由0开始的正整数,比如eth0.eth1...... ethX.而普通猫和ADSL的接口 ...

  4. Git配置信息相关命令

    查看git所有配置项 $ git config -l or $ git config --list 全局配置用户名邮箱 $ git config --global user.name "yo ...

  5. niginx相关命令及代理配置

    安装 in mac https://www.cnblogs.com/meng1314-shuai/p/8335140.html Nginx相关命令 mac下启动: 通过brew 安装install 后 ...

  6. 『学了就忘』Linux基础命令 — 34、配置网络相关命令

    目录 1.配置网络常用命令 2.ifconfig命令 3.ping命令 4.netstat 命令 使用1:查看本机开启的端口 使用2:查看本机有哪些程序开启的端口 使用3:查看所有连接 使用4:查看网 ...

  7. 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令

    Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...

  8. Linux中mod相关的命令 内核模块化 mod相关命令都是用来动态加载内核模块/驱动程序模块

    Linux中mod相关的命令 内核模块化   mod相关命令都是用来动态加载内核模块/驱动程序模块 http://baike.baidu.com/link?url=lxiKxFvYm-UfJIxMjz ...

  9. Redis常用命令手册:服务器相关命令

    Redis提供了丰富的命令(command)对数据库和各种数据类型进行操作,这些command可以在Linux终端使用.在编程时,比如各类语言包,这些命令都有对应的方法.下面将Redis提供的命令做一 ...

随机推荐

  1. linux发布环境初始化脚本

    #参数配置 homeDir=$(pwd) tomcatDir=$homeDir/tomcat logDir=$homeDir/tomcat/logs backUpDir=$homeDir/backup ...

  2. react-native-scrollable-tab-view 中嵌套了react-native-swiper产生的bug

    前段时间用RN的时候遇到过这个问题用scrollable-tab-view(scrollableView)这个组件然后嵌套轮播swiper会出现,在scrollableView  nitialPage ...

  3. git:distributed is the new centralized-part1

    PART 1 梗概 git文件流转有三个工作区域:工作目录(working directory).暂存区域(staging area).本地仓库(repository).文件处于上述三个工作区域的状态 ...

  4. 【sklearn入门】通过sklearn实现k-means并可视化聚类结果

    import numpy as np from sklearn.cluster import KMeans from mpl_toolkits.mplot3d import Axes3D import ...

  5. Python 子进程不能input

    from threading import Thread from multiprocessing import Process def f1(): name = input('请输入名字') #EO ...

  6. JavaScript·cookie

    1.什么是cookie 页面用来保存信息 ,比如自动登录.记住用户名 JS中使用cookie:docucment.cookie 2.cookie的使用

  7. HTML学习笔记01(标签)

    <html> <head> <meta charset = "utf-8"> <!--字符集编码设置-->   <title& ...

  8. Heap Sort - recursion

    Heap Sort  Build a max heap using exsiting array, which is called Heapify Swap root with the last el ...

  9. QT | 一些学习心得

    1. 如何使控件随着窗口大小变化而自动填充? 选中控件中最外层的那个控件,如centralWidget(不要去选中内部的小控件,这样能够保证内部的相对位置) 然后对centralWidget选择布局方 ...

  10. autofac使用总结

    转摘自:http://niuyi.github.io/blog/2012/04/06/autofac-by-unit-test/ 注册部分: AutoFac是.net平台下的IOC容器产品,它可以管理 ...