zoukankan      html  css  js  c++  java
  • linux下时间的同步

    echo "unset MAILCHECK">> /etc/profile

    . /etc/profile

    source /etc/profile

    时间同步:

    Date –R

    比我的时间快12个小时

    Tzselect

    先设置地区

    并且设置环境变量

    echo "export TZ='Asia/Shanghai'" >>/etc/profile

    source /etc/profile

    (如果没有ntpdate服务可用yum安装,执行下条命令成功的即可不用往下看了

    出错yum install -y rdate安装了这个,

    执行了同步命令

    rdate -s  time-b.nist.gov

    systemctl stop firewalld(不关闭防火墙的话,需要指定123端口开放)

    rdate -s  time-b.nist.gov(执行时可能会有超时提醒,再执行一次就好了)

    (rdate -s time.nist.gov)

     设置完,之后记得重启一下系统日志服务

    systemctl restart   rsyslog
    这样的话日志时间也会同步正确的。
    tail -1 /var/log/secure

    将硬件时间写入到系统时间:hwclock -s
    将系统时间写入到硬件时间:hwclock -w

    或者date -s 日期 时间
    date -s 2019-08-22
    date -s 09:40:32
    hwclock -w

  • 相关阅读:
    通过url在两个页面之间传值
    $.ajax数据传输成功却执行失败的回调函数
    5.26小测
    洛谷——AC记
    7.2模拟赛
    6.30模拟赛
    洛谷——每日一题
    洛谷——动态规划
    致创营
    BSGS
  • 原文地址:https://www.cnblogs.com/jiayannvwang/p/9577550.html
Copyright © 2011-2022 走看看