Linux 系统时间同步

NTP

ntpdate cn.pool.ntp.org

crontab -e

*/1 * * * * root /usr/sbin/ntpdate cn.pool.ntp.org

systemctl restart cron(crond)

 

HTTP

date -s "$(curl -sD - google.com | grep '^Date:' | cut -d' ' -f3-6)Z"      (境外)

date -s "$(curl -sD - baidu.com | grep '^Date:' | cut -d' ' -f3-6)Z"        (境内)

hwclock -w

posted @ 2023-11-17 14:52  demoduan  阅读(22)  评论(0)    收藏  举报