ntp server 的搭建和配置见 https://www.cnblogs.com/30go/p/11231110.html
客户端同步时间的 *** 作见:https://cloud.tencent.com/developer/article/1832436
https://www.farland.vip/2021/01/26/ubuntu-change-timezone-ntp-server/
使用 timedatectl 的 *** 作如下:
timedatectl --help timedatectl [OPTIONS...] COMMAND ... Query or change system time and date settings. Commands: status Show current time settings show Show properties of systemd-timedated set-time TIME Set system time set-timezone ZONE Set system time zone list-timezones Show known time zones set-local-rtc BOOL Control whether RTC is in local time set-ntp BOOL Enable or disable network time synchronization systemd-timesyncd Commands: timesync-status Show status of systemd-timesyncd show-timesync Show properties of systemd-timesyncd Options: -h --help Show this help message --version Show package version --no-pager Do not pipe output into a pager --no-ask-password Do not prompt for password -H --host=[USER@]HOST Operate on remote host -M --machine=ConTAINER Operate on local container --adjust-system-clock Adjust system clock when changing local RTC mode --monitor Monitor status of systemd-timesyncd -p --property=NAME Show only properties by this name -a --all Show all properties, including empty ones --value When showing properties, only print the value See the timedatectl(1) man page for details.
关闭时间同步服务的 *** 作: timedatectl set-ntp false,打开时间同步服务的 *** 作:timedatectl set-ntp true,具体的执行结果可以通过 timedatectl status 查看
配置文件 /etc/systemd/timesyncd.conf 中的下列两个配置表示轮询的最低时间和轮询的最大时间,单位 秒,测试证明两者设置为同一个值也可以工作
# 表时 ntp 服务的 ip #NTP=192.168.1.2 #轮询的最小时间间隔 #PollIntervalMinSec=32 #轮询的最大时间间隔 #PollIntervalMaxSec=2048
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)