Skip to main content

NTP synchronized cannot set to yes

· One min read

CentOS 7.5, 配置过 ntpd 与某个时间服务器同步后,偶然发现某一个节点的 NTP synchronized 一直是 no:

# timedatectl
Local time: 二 2019-07-30 09:41:08 CST
Universal time: 二 2019-07-30 01:41:08 UTC
RTC time: 二 2019-07-30 01:08:13
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

停掉 ntpd, 执行 ntpd -gq 重新调整时间后,再启动 ntpd:

# systemctl stop ntpd
# ntpd -gq
ntpd: time slew +0.000041s
# systemctl start ntpd

等待一会儿后,NTP synchronized 恢复成 yes:

# timedatectl
Local time: 二 2019-07-30 09:44:28 CST
Universal time: 二 2019-07-30 01:44:28 UTC
RTC time: 二 2019-07-30 01:44:28
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

Ref: https://askubuntu.com/questions/929805/timedatectl-ntp-sync-cannot-set-to-yes

How to override an ASP.NET Core configuration array setting using environment variables

· One min read

假如一个 appsettings.json 文件, 需要在环境变量中添加配置覆盖 AppSettings/EnabledWorkspace 节:

{
"Logging": {
"LogLevel": {
"Default": "Warning",
"System": "Information",
"Microsoft": "Information"
}
},
//Basic Auth for Tapd api
"AppSettings": {
"EnabledWorkspace": [ "58645295", "44506107", "84506239" ]
}
}

这样配置:

AppSettings__EnabledWorkspace__0 = 58645295 AppSettings__EnabledWorkspace__1 = 44506107 AppSettings__EnabledWorkspace__2 = 84506239

Refer to:

How to override an ASP.NET Core configuration array setting using environment variables

Configuration in ASP.NET Core

ClustrMaps