centos 时钟配置
centos 7 时钟配置:
timedatectl 命令:
[root@localhost ~]# timedatectl --help
timedatectl [OPTIONS...] COMMAND ... Query or change system time and date settings. -h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Control whether NTP is enabled
[root@localhost ~]#
1.显示当前系统的时间和日期时区信息:
[root@localhost ~]# timedatectl
Local time: 四 -- :: CST
Universal time: 四 -- :: UTC
RTC time: 四 -- ::
Time zone: Asia/Shanghai (CST, +)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[root@localhost ~]#
2.根据地址位置查询当前可用的时区设置:
root@localhost ~]# timedatectl list-timezones |grep 'Asia/S'
Asia/Sakhalin
Asia/Samarkand
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Srednekolymsk
[root@localhost ~]#
3.在Linux系统中设置北京时区:
[root@localhost ~]# timedatectl set-timezone 'Asia/Shanghai'
[root@localhost ~]#
4.设置时间
[root@localhost ~]# timedatectl set-time '2019-04-04 14:59'
5.hwclock
hwclock
硬件时钟,顾名思义,这个时间时存储在服务器主板上的时钟。硬件时钟存储的值包括:年、月、日、时、分、秒。不存储时间标准、本地时间、UTC、DST。这些设置存放在/etc/adjtime中,当我们修改时间设置(包括手动设置和自动同步)时该文件被创建。在RHEL6或CentOS6系统中,系统每次关机或重启都会自动执行这个命令。在RHEL7或CentOS7中,当系统时间向NTP服务器或PTP服务器同步时间后,每隔11分钟内核自动同步硬件时钟到系统时钟。
(1)显示硬件时钟。
[root@localhost ~]# hwclock
2019年04月04日 星期四 14时17分03秒 -0.400305 秒
[root@localhost ~]#
( 2 )将硬件时钟同步给系统时钟。
-s和–hctosys效果是一样的。
root@localhost ~]# hwclock --systohc
[root@localhost ~]# hwclock -s
[root@localhost ~]# hwclock
2019年04月04日 星期四 15时05分01秒 -0.319360 秒
[root@localhost ~]#
( 3 ) 将系统时间写入硬件时钟
[root@localhost ~]# hwclock -w
6.crontab 定时执行时间同步
min hour dayofmonth month dayofweek command
minute: 表示分钟,可以是从0到59之间的任何整数。 hour:表示小时,可以是从0到23之间的任何整数。 day:表示日期,可以是从1到31之间的任何整数。 month:表示月份,可以是从1到12之间的任何整数。 week:表示星期几,可以是从0到7之间的任何整数,这里的0或7代表星期日。 command:要执行的命令,可以是系统命令,也可以是自己编写的脚本文件。
centos 时钟配置的更多相关文章
- Centos网络配置
网上搜索:centos网络配置的方法,主要包括dns.网关.IP地址,主要是配置resolv.conf\network\ifcfg-eth0这些网络配置文件. 稍后我会就centos7的网络配置进行实 ...
- 阿里云服务器Linux CentOS安装配置(零)目录
阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...
- 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
- 阿里云服务器Linux CentOS安装配置(七)域名解析
阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...
- 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...
- 阿里云服务器Linux CentOS安装配置(五)jetty配置、部署
阿里云服务器Linux CentOS安装配置(五)jetty配置.部署 1.官网下载jetty:wget http://repo1.maven.org/maven2/org/eclipse/jetty ...
- 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat
阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat 执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...
- 阿里云服务器Linux CentOS安装配置(三)yum安装mysql
阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...
随机推荐
- Linux filesystem
文件系统的运作与操作系统的文件数据有关.较新的操作系统的文件数据除了文件实际内容外,通常含有非常多的属性,例如Linux操作系统的文件权限(rwx)与文件属性(属主.属组.时间参数等).文件系统通常会 ...
- c++库函数 Map
转载:https://blog.csdn.net/shuzfan/article/details/53115922 C++中map提供的是一种键值对容器,里面的数据都是成对出现的,如下图:每一对中的第 ...
- laradock
配置xdebug:http://m.php.cn/article/407434.html
- Caused by: java.lang.ClassNotFoundException: org.springframework.integration.handler.support.HandlerMethodArgumentResolversHolder
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring ...
- JS正则练习集
基础练习: //连续3个数字 var pattern1 = /\d{3}/g; console.log(pattern1.test('s23')); // false console.log(patt ...
- JMeter-性能测试监控(解决.sh文件的启动)
下载插件 https://jmeter-plugins.org/downloads/old/ 已安装了jmeter-plugins-manager,装的这个不知道生没生效.... 2.问题:启动就显示 ...
- 利用MathType为公式编号并引用
序言 在理工科的论文撰写过程中, 公式编辑.编号以及引用非常普遍, 但是笔者没有发现word本身对公式编号和引用有比较好的支持, 所以只好求助于第三方插件. MathType在公式编辑方面表现比较出色 ...
- python 开发环境部署
pip 通过google搜索到,2019.4月的版本是19. 需要更换源,否则会挺慢. Windows下更换pip源为清华源 打开appdata文件夹,在资源管理器的地址栏输入%appdata%后回车 ...
- 关于JS的原型与继承笔记
1.什么是原型? 原型就是公用的方法或者属性. 1.prototype本质上还是一个JavaScript对象: 2.每个函数都有一个默认的属性prototype,而这个prototype的constr ...
- Docker入门详解(转载)
来源 http://dockone.io http://dockone.io/article/6051 Docker是世界领先的软件容器平台,所以想要搞懂Docker的概念我们必须先从容器开始说起. ...