调整linux系统时间和时区与Internet时间同步
一、修改时区:
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
修改为中国的东八区
# vi /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=false
ARC=false
二、配置新的时间
日期设定:
# date -s 2008/05/06
时间设定:
# date -s 18:40:00
查看硬件时间(BIOS的):
    hwclock [-rw] 
    -r:查看现有BIOS时间,默认为-r参数
    -w:将现在的linux系统时间写入BIOS中
    当我们进行完 Linux 时间的校时后,还需要以 hwclock -w 来更新 BIOS 的时间,因为每次开机的时候,系统会重新由 BIOS 将时间读出来,所以, BIOS 才是重要的时间依据。
# hwclock
Tue 06 May 2008 03:49:37 PM CST  -0.039646 seconds
同步BIOS时钟,强制把系统时间写入CMOS:
# clock -w
三、实现Internet时间同步(这里可以忽略上面两步)
方法1. 开机的时候自动网络校时: 
    vi /etc/rc.d/rc.local 
    /usr/sbin/ntpdate -u 192.168.0.2 192.168.0.3 192.168.0.4;   /sbin/hwclock -w
方法2. 设定计划任务 
crontab格式如下:
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  command to be executed
设定crontab计划任务也有两种方式:
1、写在/etc/crontab里
代码:
00 11 * * * root ntpdate 210.72.145.44
每天11点与中国国家授时中心同步时间
每天11点与中国国家授时中心同步时间
当然前提是
apt-get install ntpdate
代码也可是
00 11 * * * root ntpdate us.pool.ntp.org
2、使用命令crontab -e
crontab -e 
    10 5 * * * root ntpdate us.pool.ntp.org;hwclock -w 
这样每天5:10自动进行网络校时,并同时更新BIOS的时间

Linux_自动调整linux系统时间和时区与Internet时间同步的更多相关文章

  1. 自动调整linux系统时间和时区与Internet时间同步

    调整linux系统时间和时区与Internet时间同步 一.修改时区:# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime修改为中国的东八区# v ...

  2. 查看linux系统时间和时区

    参考地址:http://lidao.blog.51cto.com/ 一.使用date命令查看系统时间 [root@benbang ~]# date -R Tue, 01 Aug 2017 15:43: ...

  3. Linux下自动调整时间和时区与Internet时间同步

    (原文链接) 调整linux系统时间和时区与Internet时间同步一.修改时区:# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime修改为中国的 ...

  4. linux系统修改CST时区

    ================================================= [root@tzyyserveryg ~]# date -R Fri, 28 Nov 2014 08 ...

  5. linux 修改时间和时区

    linux系统时间有两个,一个是硬件时间,即BIOS时间,就是我们进行CMOS设置时看到的时间,另一个是系统时间,是linux系统Kernel时间.当Linux启动时,系统Kernel会去读取硬件时钟 ...

  6. Linux系统时间同步方法小结

    在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...

  7. Linux的硬件时间、校正Linux系统时间及系统时间调用流程

    第一部分: 一)概述: 事实上在Linux中有两个时钟系统,分别是系统时间和硬件时间 UTC是协调世界时(Universal Time Coordinated)英文缩写,它比北京时间早8个小时.   ...

  8. linux 系统时间 硬件时间

    Linux时钟分为系统时钟(System Clock)和硬件时钟(Real Time Clock,简称RTC).系统时钟是指当前Linux Kernel中的时钟:而硬件时钟则是主板上由电池供电的时钟, ...

  9. Linux系统时间同步方法

    在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...

随机推荐

  1. Balanced Binary Tree

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  2. jdk新特性

    自动拆装箱子: import org.junit.Test; public class Demo { /* * 自动拆装箱 * */ @Test public void ZhuangXiang() { ...

  3. iterator与const_iterator及const iterator区别

    如果你传递过来一个const类型的容器,那么只能用const_iterator来遍历.  C++ Code  12345   void Method(const vector<int> v ...

  4. 在64位的linux上运行32位的程序

    1.症状 (1)执行bin文件时提示:No such file or directory (2)ldd bin文件  的输出为: not a dynamic executable (3)file bi ...

  5. 14.python笔记之paramiko

    作者:刘耀 博客:www.liuyao.me 博客园:www.cnblogs.com/liu-yao 转载请注明 一,介绍 1.使用paramiko可以很好的解决以上问题,比起前面的方法,它仅需要在本 ...

  6. extjs插件开发上传下载文件简单案例

    前台,extjs,框架,mybatis,spring,springMVC,简单的文件上传下载案例. 必要的jar包,commons-fileupload-1.3.1.jar,commons-io-2. ...

  7. OpenGL在 win8 64bits系统下的配置

    1 program files(x86)与program files 在64位系统下,为了更好的兼容32位程序,在安装一些32位程序(注意某些程序他就是32位的),会默认扔到program files ...

  8. fedora yum 使用代理的方法

    配置yum: 编辑/etc/yum.conf添加下列一行: proxy=http://domain/user:passwd@<proxy ip>:80 <proxy ip>:代 ...

  9. 安装phpredis模块

    [root@web01 src]# wget github.com/owlient/phpredis/tarball/master [root@web01 src]# tar -xzvf master ...

  10. iptables 无法连外网

    [root@v01-svn-test-server ~]# service iptables status Table: filter Chain INPUT (policy DROP) num ta ...