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 ...
随机推荐
- PDF在线解除密码的方法是什么
大家在网上下载一些关于PDF文件的时候通常会发现有的PDF文件是有密码的,有密码的文件通常是不可以被转换的,这个时候我们就需要将其密码解除掉,这样后期不仅方便阅读也方便了PDF文件的转换. 操作工具: ...
- centos开启防火墙
https://www.cnblogs.com/oskyhg/p/8011001.html
- poj1164
#include<iostream> using namespace std; ][]; ][]; int roomnum; int maxroom; int m,n; typedef s ...
- Jmeter跨线程组传递参数
Jmeter的线程组之间是相互独立的,各个线程组互不影响,所以线程组A中输出的参数,是无法直接在线程组B中被调用的. 但有时候为了方便,可以把不同模块接口放在不同线程组,就涉及不同线程组传参问题,比如 ...
- 2PC/3PC/Paxos
在分布式系统中,一个事务可能涉及到集群中的多个节点.单个节点很容易知道自己执行的事务成功还是失败,但因为网络不可靠难以了解其它节点的执行状态(可能事务执行成功但网络访问超时). 若部分节点事务执行失败 ...
- [转]Jmeter + Grafana + InfluxDB 性能测试监控
https://www.cnblogs.com/yyhh/p/5990228.html Jmeter + Grafana + InfluxDB 性能测试监控 效果不错
- c++ STL概述
2018-09-26 c++ STL(标准模板库)是一套通过c++模板类实现的标准类库,提供了通用的模板和函数,功能强大,大大的提高了c++的开发效率. c++ STL的核心主要包括三个组件:(1)容 ...
- TCP/IP 免费ARP
免费ARP Gratuitous ARP也称为免费ARP.Gratui ARP不同于一般的ARP请求,它并非期待得到IP对应的MAC地址,而是当主机启动的时候,将发送一个Gratuitous arp请 ...
- 输入参数的默认值设定${3:-var_d}
今天看到一个不一样的写法: if [ $# != 2 ] && [ $# != 3 ] ; then #判断参数个数 echo "Invalid Args" ...
- Linux rh7环境下安装Oracle数据库
1.修改Linux系统的参数 1)检查系统的版本 # more /etc/redhat-release 2)关闭SELinux,需要restart # sed -i 's/SELINUX=enforc ...