Linux服务器时间设置及同步
来源:互联网 发布:js splice 参数 编辑:程序博客网 时间:2024/05/17 06:02
1 手动设置
date命令:
date :查看当前时间,结果如下:Wed Feb 4 16:29:51 CST 2015
date -s 16:30:00 :设置当前时间,结果如下:Wed Feb 4 16:30:00 CST 2015
date -s "YYYY-MM-DD hh:mm[:ss]" 如date -s "2015-02-04 16:30:00"
hwclock -w(将时间写入bios避免重启失效)
2 同步网络
ntpdate命令:
ntpdate -u 210.72.145.44 :网络时间同步命令
注意:若不加上-u参数, 会出现以下提示:no server suitable for synchronization found
-u:从man ntpdate中可以看出-u参数可以越过防火墙与主机同步;
210.72.145.44:中国国家授时中心的官方服务器。
ntp常用服务器:
中国国家授时中心:210.72.145.44
NTP服务器(上海) :ntp.api.bz
美国:time.nist.gov
复旦:ntp.fudan.edu.cn
微软公司授时主机(美国) :time.windows.com
台警大授时中心(台湾):asia.pool.ntp.org
经测试中国国家授时中心与NTP上海服务器可以正常同步时间,注意需要加上-u参数!
3 时区修改
3.1 即时生效
修改/etc/sysconfig/clock文件,把ZONE的值改为Asia/Shanghai,UTC值改为false,改完后的文件如下:
****************************************************************************************
原文地址:http://blog.csdn.net/jesseyoung/article/details/43488351
博客主页:http://blog.csdn.net/jesseyoung
****************************************************************************************
date命令:
date :查看当前时间,结果如下:Wed Feb 4 16:29:51 CST 2015
date -s 16:30:00 :设置当前时间,结果如下:Wed Feb 4 16:30:00 CST 2015
date -s "YYYY-MM-DD hh:mm[:ss]" 如date -s "2015-02-04 16:30:00"
hwclock -w(将时间写入bios避免重启失效)
2 同步网络
ntpdate命令:
ntpdate -u 210.72.145.44 :网络时间同步命令
注意:若不加上-u参数, 会出现以下提示:no server suitable for synchronization found
-u:从man ntpdate中可以看出-u参数可以越过防火墙与主机同步;
210.72.145.44:中国国家授时中心的官方服务器。
ntp常用服务器:
中国国家授时中心:210.72.145.44
NTP服务器(上海) :ntp.api.bz
美国:time.nist.gov
复旦:ntp.fudan.edu.cn
微软公司授时主机(美国) :time.windows.com
台警大授时中心(台湾):asia.pool.ntp.org
经测试中国国家授时中心与NTP上海服务器可以正常同步时间,注意需要加上-u参数!
3 时区修改
3.1 即时生效
[root@localhost /]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [root@localhost /]# hwclock3.2 重启生效
修改/etc/sysconfig/clock文件,把ZONE的值改为Asia/Shanghai,UTC值改为false,改完后的文件如下:
# The time zone of the system is defined by the contents of /etc/localtime.# This file is only for evaluation by system-config-date, do not rely on its# contents elsewhere.ZONE="Asia/Shanghai"UTC=falseARC=false
****************************************************************************************
原文地址:http://blog.csdn.net/jesseyoung/article/details/43488351
博客主页:http://blog.csdn.net/jesseyoung
****************************************************************************************
0 0
- Linux服务器时间设置及同步
- Linux服务器时间设置及同步
- 设置Linux服务器时间同步
- Linux 服务器时间同步设置
- linux的ntp服务器时间同步设置
- 设置linux服务器时间与网络同步
- 设置linux服务器定时与时间服务器同步
- CentOS Linux同步服务器时间及自动同步
- Linux服务器时间同步
- Linux服务器时间同步
- Linux服务器同步时间
- Linux服务器时间同步
- linux服务器同步时间
- Linux 服务器时间同步
- Linux服务器时间同步
- Linux服务器时间同步
- linux 服务器时间同步
- linux 服务器时间同步
- C语言常用文件操作
- [转载]visio类图中的接口和实现类关系的画法
- Lua的pcall错误处理定位行号
- 计算器。。。GridLayout
- Newtonsoft.Json 时间格式设置,替换null为""
- Linux服务器时间设置及同步
- 补上漏下的几篇博客
- AndroidのListView之滑动列表项(点击事件和滑动事件共存)
- ASP.NET的Excel导出问题
- struts2 获取list的索引
- 幻立方解法之4阶,5阶,7阶
- 关于ligercombobox
- UVA202
- Swift中navigationBar相关属性设置