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 ...
随机推荐
- Python 学习笔记10 函数
函数其实一段带名字的代码段,我们可以根据代码段,重复执行某一段代码段,或者有条件的执行某一段代码段. 将一段代码定义成函数后,我们可以很方便的根据自己的需求,随时调用该代码段.遇到需求变化的时候,只需 ...
- jquery 改变img的src
jQuery修改img的src的方法: $("#img_id").attr("src","new_src"); 此语句的功能是:修改id为i ...
- 插值代码17个---MATLAB
函数名 功能Language 求已知数据点的拉格朗日插值多项式Atken 求已知数据点的艾特肯插值多项式Newton 求已知数据点的均差形式的牛顿插值多项式Newtonforward 求已知数据点的前 ...
- 自己写的一些公共js方法
/* 说明文件:这里用的都是es6的语法 导入导出,拿vue举个栗子,你只需要在用到的地方,按需要导入就行了,然后在mounted中直接可以拿来用 比如下面的手机****方法,在需要用到的地方impo ...
- c# 设置开机启动
private static RegistryKey _rlocal = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Wi ...
- VS2017 + EF6连接MySql
VS2017 + EF6连接MySql 原地址:https://blog.csdn.net/mzhifa/article/details/80999105 VS2017 + EF6连接MySql ...
- MUI 返回顶部
//绑定滚动到顶部按钮事件 if ($("#scroll-up").length > 0) { var scrollToTopBox = $("#scroll-up ...
- kafka笔记9(监控)
Kafka提供的所有度量指标都是通过JMX(Java Management Extensions)接口访问 JMX端口查询: zookeeper上获取端口信息 /brokers/ids/<I ...
- Lintcode: Nuts & Bolts Problem
Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping ...
- EntityFramework如何创建索引?
一.首先创建一个类 FwEntityTypeConfiguration 继承 EntityTypeConfiguration ,该类完整代码如下: using System.Data.Entity.M ...