更新 Linux 服务器时间
Linux ntp 大约 553 字查看时间
命令:
date
输出:
Wed Jul 17 15:49:15 CST 2019
更新时间
命令:
sudo ntpdate 0.asia.pool.ntp.org
输出:
17 Jul 15:57:27 ntpdate[30572]: adjust time server 133.243.238.163 offset -0.030614 sec
the NTP socket is in use, exiting
ntpd
服务已启动,不用再更新时间。
查看ntpd
服务是否启动:
ps aux | grep ntpd
启动 ntpd 服务
-c
:指定配置文件,默认/etc/ntp.conf
-p
:指定记录ntpd
进程ID
的文件
-g
:通常如果系统时间与服务器时间差别太大(默认是1000
秒),ntpd
则会自动退出,并记录到日志文件。该选项允许不理会该门限。但该命令只能有效一次,如果第一次同步后,客户端的时差依然超过门限,则ntpd
会自动退出,并记录在日志文件。
ntpd -p /var/run/ntpd.pid -g
查看硬件时间
hwclock
hwclock -r
hwclock --show
同步硬件时间
hwclock –w
hwclock --systohc
阅读 2286 · 发布于 2019-07-17
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Alpine Linux 安装 Docker阅读 1605
-
Arthas 启动报 ClassNotFoundException com.sun.tools.attach.VirtualMachine阅读 3897
-
JMeter 使用 Loop Controller 进行循环请求阅读 1513
-
Spring Boot Slf4j MDC 实现全链路日志追踪阅读 278
-
Golang 操作 csv阅读 1072
-
Android 揭露效果 Reveal Effect阅读 1888
-
Android 使用 tools schemas 预览 UI阅读 1750
-
Linux中/bin、/sbin、/usr/bin、/usr/sbin、/usr/local/bin、/usr/local/sbin 目录的含义及区别阅读 1139
-
PHP curl 报错:SSL connect error阅读 2485
-
编译时提示 virtual memory exhausted: Cannot allocate memory阅读 2500