Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
209fed7
Squashed commit of the following:
Sindhuja-Muthukrishnan Mar 6, 2026
ff4de02
Update systimemgr_git.bb
sindhu-krishnan Mar 6, 2026
a3806be
Apply suggestion from @Copilot
sindhu-krishnan Mar 9, 2026
7e21c81
Update chrony-conf-update.sh
sindhu-krishnan Mar 9, 2026
7c9f478
Update chrony-sync-notify.sh
sindhu-krishnan Mar 9, 2026
0fc33a7
Update chrony-sync-notify.service
sindhu-krishnan Mar 9, 2026
2064cfc
Update chrony-sync-notify.sh
sindhu-krishnan Mar 9, 2026
06f80bc
Update chrony-tracking.service
sindhu-krishnan Mar 9, 2026
f3d603f
Update chrony-tracking.service
sindhu-krishnan Mar 9, 2026
e8d62b1
Update chrony-tracking.timer
sindhu-krishnan Mar 9, 2026
fb1e339
Update chrony.conf
sindhu-krishnan Mar 9, 2026
2d281a5
Update chrony_tracking.sh
sindhu-krishnan Mar 9, 2026
a6d51c0
Update chrony-tracking.service
sindhu-krishnan Mar 9, 2026
a6af6f8
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
6f9cbca
Update chrony-sync-notify.sh
sindhu-krishnan Mar 9, 2026
c089159
Update chrony-conf-update.sh
sindhu-krishnan Mar 9, 2026
c187fdb
Update systimemgr_git.bb
sindhu-krishnan Mar 9, 2026
743079c
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
020dcd9
Update chrony-sync-notify.sh
sindhu-krishnan Mar 9, 2026
fd5e8e4
Apply suggestion from @Copilot
sindhu-krishnan Mar 9, 2026
75a616f
Update chrony-tracking.timer
sindhu-krishnan Mar 9, 2026
bbe4013
Update chrony-tracking.service
sindhu-krishnan Mar 9, 2026
8222256
Update chrony-tracking.timer
sindhu-krishnan Mar 9, 2026
3ad063f
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
6f3b605
Update rdk.conf
sindhu-krishnan Mar 9, 2026
9f96459
Apply suggestion from @Copilot
sindhu-krishnan Mar 9, 2026
c98feab
Apply suggestion from @Copilot
sindhu-krishnan Mar 9, 2026
25e07f6
Update chrony-tracking.service
sindhu-krishnan Mar 9, 2026
5c73a64
Update chrony.conf
sindhu-krishnan Mar 9, 2026
762de71
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
d5e81b1
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
93b0328
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
e79cfaa
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
3edd7d9
Update chrony-conf-update.sh
sindhu-krishnan Mar 9, 2026
7ddf68b
Update chrony.conf
sindhu-krishnan Mar 9, 2026
3ba0ed7
Update rdk_chrony.conf
sindhu-krishnan Mar 9, 2026
5ce5546
Update chronyd.service
sindhu-krishnan Mar 9, 2026
b0a07f0
Update chrony-conf-update.sh
sindhu-krishnan Mar 9, 2026
6dff2da
Update chrony-conf-update.sh
sindhu-krishnan Mar 9, 2026
9e1f056
Update rdk.conf
sindhu-krishnan Mar 9, 2026
3661cc1
Update chrony-sync-notify.sh
sindhu-krishnan Mar 9, 2026
42ca1ce
Update chrony_%.bbappend
sindhu-krishnan Mar 9, 2026
82d0261
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
aea254f
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
a7474d8
Update chronyd.service
sindhu-krishnan Mar 10, 2026
186428f
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
8473ca9
Update systimemgr_git.bb
sindhu-krishnan Mar 10, 2026
8f21c96
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
00b9681
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
5ede993
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
2b738ab
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
430e31d
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
61a0d58
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
f4d8dc5
Update chrony-conf-update.sh
sindhu-krishnan Mar 10, 2026
1902e5a
Update chrony-sync-notify.sh
sindhu-krishnan Mar 10, 2026
4708928
Update chrony-sync-notify.sh
sindhu-krishnan Mar 10, 2026
590a088
Update chrony-sync-notify.sh
sindhu-krishnan Mar 11, 2026
3d643ab
Merge pull request #644 from rdkcentral/develop
sindhu-krishnan Mar 11, 2026
563cb92
Update chrony-sync-notify.sh
sindhu-krishnan Mar 11, 2026
af50cbb
Update chrony-sync-notify.service
sindhu-krishnan Mar 11, 2026
a8d26f0
Update chrony-sync-notify.sh
sindhu-krishnan Mar 11, 2026
7c8d5e2
Update chrony_%.bbappend
sindhu-krishnan Mar 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/distro/rdk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ VOLATILE_BINDS:append = "/var/volatile/asound.conf /etc/asound.conf\n"
VOLATILE_BINDS:append = "/var/volatile/resolv.dnsmasq /etc/resolv.dnsmasq\n"
VOLATILE_BINDS:append = "/var/volatile/hosts /etc/hosts\n"
VOLATILE_BINDS:append = "/var/volatile/hostname /etc/hostname\n"
VOLATILE_BINDS:append:client = "/var/volatile/rdk_chrony.conf /etc/rdk_chrony.conf\n"
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
VOLATILE_BINDS:append = "/var/volatile/dhcp_static_hosts /etc/dhcp_static_hosts\n"
VOLATILE_BINDS:append = "/var/volatile/cron /var/spool/cron\n"
VOLATILE_BINDS:append:hybrid = "/tmp/snmpd.conf /etc/snmp/snmpd.conf\n"
Expand All @@ -253,7 +254,6 @@ VOLATILE_BINDS:append = "/tmp/bind /var/cache/bind\n"
VOLATILE_BINDS:append = "/tmp/stunnel.conf /etc/stunnel.conf\n"



XZ_COMPRESSION_LEVEL ?= "-e -M 50% -9"

include include/rdk-external-src.inc
Expand Down
2 changes: 1 addition & 1 deletion recipes-common/systimemgr/systimemgr_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

DEPENDS = "systimemgrinetrface systimemgrfactory rdk-logger libsyswrapper wpeframework-clientlibraries telemetry"

SRCREV_systemtimemgr = "f7c52d3ebe5203134d7ecc242f86fbbd96d39c05"
SRCREV_systemtimemgr = "0d24d84a4a61f19fb7b0b06dfa5131735135fe0b"
SRC_URI = "${CMF_GITHUB_ROOT}/systemtimemgr;${CMF_GITHUB_SRC_URI_SUFFIX};name=systemtimemgr"

SRC_URI:append = " file://systimemgr.conf "
Expand Down
57 changes: 57 additions & 0 deletions recipes-support/chrony/chrony_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"


SRC_URI += "file://chrony.conf \
file://chronyd.service \
file://rdk_chrony.conf \
file://chrony-sync-notify.sh \
file://chrony-sync-notify.service \
file://chrony-conf-update.sh \
file://chrony-tracking.timer \
file://chrony-tracking.service \
file://chrony_tracking.sh \
"

do_install:append() {
# Binaries
install -m 0755 ${S}/chronyc ${D}${sbindir}
install -d ${D}${base_libdir}/rdk
Comment thread
sindhu-krishnan marked this conversation as resolved.

#config File
rm -rf ${D}${sysconfdir}/chrony.conf
install -m 0644 ${WORKDIR}/chrony.conf ${D}${sysconfdir}/
install -m 0644 ${WORKDIR}/rdk_chrony.conf ${D}${sysconfdir}/
Comment thread
sindhu-krishnan marked this conversation as resolved.
install -m 0755 ${WORKDIR}/chrony-sync-notify.sh ${D}${base_libdir}/rdk
install -m 0755 ${WORKDIR}/chrony-conf-update.sh ${D}${base_libdir}/rdk
install -m 0755 ${WORKDIR}/chrony_tracking.sh ${D}${base_libdir}/rdk


# service to start chrony
rm -rf ${D}${systemd_unitdir}/system/chronyd.service
install -m 0644 ${WORKDIR}/chronyd.service ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/chrony-sync-notify.service ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/chrony-tracking.service ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/chrony-tracking.timer ${D}${systemd_unitdir}/system/
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.

}


FILES:${PN} += "${sbindir}/chronyc"
FILES:${PN} += "${base_libdir}/rdk/chrony-sync-notify.sh"
CONFFILES:${PN} += "${sysconfdir}/chrony.conf"
CONFFILES:${PN} += "${sysconfdir}/rdk_chrony.conf"
FILES:${PN} += "${base_libdir}/rdk/chrony-conf-update.sh"
FILES:${PN} += "${base_libdir}/rdk/chrony_tracking.sh"

SYSTEMD_SERVICE:${PN} += "chronyd.service"
SYSTEMD_SERVICE:${PN} += "chrony-sync-notify.service"
SYSTEMD_SERVICE:${PN} += "chrony-tracking.service"
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
SYSTEMD_SERVICE:${PN} += "chrony-tracking.timer"


inherit syslog-ng-config-gen
Comment thread
sindhu-krishnan marked this conversation as resolved.
SYSLOG-NG_FILTER = "chronyd"
SYSLOG-NG_SERVICE_chronyd = "chronyd.service"
SYSLOG-NG_DESTINATION_chronyd = "chrony.log"
SYSLOG-NG_LOGRATE_chronyd = "low"

151 changes: 151 additions & 0 deletions recipes-support/chrony/files/chrony-conf-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#!/bin/bash
Comment thread
sindhu-krishnan marked this conversation as resolved.
##############################################################################
# If not stated otherwise in this file or this component's LICENSE file the

Check failure on line 3 in recipes-support/chrony/files/chrony-conf-update.sh

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'recipes-support/chrony/files/chrony-conf-update.sh' (Match: rdkcentral/Thunder/R1, 15 lines, url: https://github.com/rdkcentral/Thunder/archive/refs/tags/R1.tar.gz, file: Tools/ProxyStubGenerator/Interface.py)
Comment thread
sindhu-krishnan marked this conversation as resolved.
# following copyright and licenses apply:
#
# Copyright 2020 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");

Check failure on line 8 in recipes-support/chrony/files/chrony-conf-update.sh

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'recipes-support/chrony/files/chrony-conf-update.sh' (Match: rigetti/pyquil/0, 11 lines, url: https://github.com/rigetti/pyquil/archive/refs/tags/quilt-demo-0.tar.gz, file: pyquil/api/_qam.py)
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
# Purpose : To generate the chrony configuration file (/etc/rdk_chrony.conf)
# Scope : RDK Devices
# Usage : Invoke by systemd service as part of chrony integration


LOG_FILE="/opt/logs/chrony.log"
attempts=1
max_attempts=5
CHRONY_CONF=/etc/rdk_chrony.conf

if [ -f /etc/env_setup.sh ]; then
. /etc/env_setup.sh
fi

#create directory if not already available
/bin/mkdir -p /var/lib/chrony

#Log framework to print timestamp and source script name
ntpLog()
{
echo "`/bin/timestamp` : $0: $*" >> $LOG_FILE
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
}
Comment thread
sindhu-krishnan marked this conversation as resolved.

# NTP URL from the property file
get_ntp_hosts() {
if [ -f /lib/rdk/getPartnerProperty.sh ]; then
hostName=`/lib/rdk/getPartnerProperty.sh ntpHost`
hostName2=`/lib/rdk/getPartnerProperty.sh ntpHost2`
hostName3=`/lib/rdk/getPartnerProperty.sh ntpHost3`
hostName4=`/lib/rdk/getPartnerProperty.sh ntpHost4`
hostName5=`/lib/rdk/getPartnerProperty.sh ntpHost5`

minPoll=`/lib/rdk/getPartnerProperty.sh NTPMinpoll`
maxPoll=`/lib/rdk/getPartnerProperty.sh NTPMaxpoll`

# Fetch directives for each NTP server (optional, fallback to server)
directive1=$( /lib/rdk/getPartnerProperty.sh NTPServer1Directive )
directive2=$( /lib/rdk/getPartnerProperty.sh NTPServer2Directive )
directive3=$( /lib/rdk/getPartnerProperty.sh NTPServer3Directive )
directive4=$( /lib/rdk/getPartnerProperty.sh NTPServer4Directive )
directive5=$( /lib/rdk/getPartnerProperty.sh NTPServer5Directive )
Comment thread
sindhu-krishnan marked this conversation as resolved.

fi
}

get_ntp_hosts_from_bootstrap() {
BOOTSTRAP="/opt/secure/RFC/bootstrap.ini"

if [ ! -f "$BOOTSTRAP" ]; then
ntpLog "bootstrap.ini not found at $BOOTSTRAP"
return 1
fi

# Helper to fetch key=value from bootstrap.ini (first match)
get_bs_val() {
key="$1"
# Escape regex metacharacters in key so it is matched literally
escaped_key=$(printf '%s\n' "$key" | sed 's/[][\\.^$*]/\\&/g')
# Extract RHS after '=' and trim whitespace
grep -m1 -E "^[[:space:]]*$escaped_key=" "$BOOTSTRAP" 2>/dev/null | \
cut -d'=' -f2- | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'
}

bs1="$(get_bs_val 'Device.Time.NTPServer1')"
bs2="$(get_bs_val 'Device.Time.NTPServer2')"
bs3="$(get_bs_val 'Device.Time.NTPServer3')"
bs4="$(get_bs_val 'Device.Time.NTPServer4')"
bs5="$(get_bs_val 'Device.Time.NTPServer5')"

# Only fill missing values (don’t override TR-181 values if present)
[ -z "$hostName" ] && hostName="$bs1"
[ -z "$hostName2" ] && hostName2="$bs2"
[ -z "$hostName3" ] && hostName3="$bs3"
[ -z "$hostName4" ] && hostName4="$bs4"
[ -z "$hostName5" ] && hostName5="$bs5"

return 0
}


ntpLog "Retrieve NTP Server URL from /lib/rdk/getPartnerProperty.sh..."
while [ "$attempts" -le "$max_attempts" ]; do

ntpLog "Attempt $attempts/$max_attempts to retrieve NTP server URL(s)..."
get_ntp_hosts

if [ "$hostName" ] || [ "$hostName2" ] || [ "$hostName3" ] || [ "$hostName4" ] || [ "$hostName5" ]; then
break
fi

# If this is the last attempt, try bootstrap as fallback and then break
if [ $attempts -eq $max_attempts ]; then
ntpLog "TR-181 returned empty NTP server list; falling back to /opt/secure/RFC/bootstrap.ini..."
get_ntp_hosts_from_bootstrap
break
fi

sleep 3
attempts=$((attempts + 1))

done

# Use defaults if not set
[ -z "$minPoll" ] && minPoll="10"
[ -z "$maxPoll" ] && maxPoll="12"
ntpLog "Minpoll:$minPoll MaxPoll:$maxPoll"
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated

hosts=("$hostName" "$hostName2" "$hostName3" "$hostName4" "$hostName5")
directives=("$directive1" "$directive2" "$directive3" "$directive4" "$directive5")
ntpLog "NTP Server URL for the partner:$hosts"
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated

Comment thread
sindhu-krishnan marked this conversation as resolved.
conf_written=0
> "$CHRONY_CONF"
for i in $(seq 0 4); do
host="${hosts[$i]}"
directive="${directives[$i]}"
Comment thread
sindhu-krishnan marked this conversation as resolved.
if [ -n "$host" ]; then
# use directive if set, else default to server
[ -z "$directive" ] && directive="server"
printf "%s %s iburst minpoll %s maxpoll %s\n" "$directive" "$host" "$minPoll" "$maxPoll" >> "$CHRONY_CONF"
conf_written=1
fi
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
done
Comment thread
sindhu-krishnan marked this conversation as resolved.

# fallback if no valid host found
if [ "$conf_written" -eq 0 ]; then
printf "server time.google.com iburst minpoll %s maxpoll %s\n" "$minPoll" "$maxPoll" >> "$CHRONY_CONF"
ntpLog "No valid NTP servers found, using fallback: time.google.com"
fi

ntpLog "Successfully updated $CHRONY_CONF"
exit 0
12 changes: 12 additions & 0 deletions recipes-support/chrony/files/chrony-sync-notify.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Notify when Chrony time sync is completed
Documentation=man:chronyc(1)
After=chronyd.service
ConditionPathExists=/opt/secure/RFC/chrony/chronyd_enabled

Comment thread
sindhu-krishnan marked this conversation as resolved.
[Service]
Type=oneshot
ExecStart=/lib/rdk/chrony-sync-notify.sh

[Install]
WantedBy=chronyd.service
58 changes: 58 additions & 0 deletions recipes-support/chrony/files/chrony-sync-notify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh
Comment thread
tdeva14 marked this conversation as resolved.

LOG_FILE=/opt/logs/chrony.log
NTP_DIR="/tmp/systimemgr"
NTP_FILE="$NTP_DIR/ntp"
CLOCK_EVENT="/tmp/clock-event"
SYSTEMD_DIR="/var/lib/systemd/"
SYSTEMD_CLOCK="$SYSTEMD_DIR/clock"
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated

Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
Comment thread
sindhu-krishnan marked this conversation as resolved.
log() {
echo "$1" >> "$LOG_FILE"
}

is_synced() {
chronyc tracking 2>/dev/null | grep -q "Leap status *: Normal"
}


# Wait for sync only if not already synced
#This command will wait up to about 5 minutes (3000 tries * 0.1 seconds each) until chrony reports that the system clock is synchronized
if is_synced; then
log "Chrony already synchronised"
exit 0 #TBD - Don't log milestones whenever chronyd started
else
log "Waiting for Chrony synchronisation..."
chronyc waitsync 3000 0 0 0.1 || {
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
log "waitsync failed or timed out after 5 minutes"
exit 1
}
fi

if [ ! -f "$CLOCK_EVENT" ]; then
Comment thread
sindhu-krishnan marked this conversation as resolved.
touch "$CLOCK_EVENT" && log "Created $CLOCK_EVENT"
fi
Comment thread
sindhu-krishnan marked this conversation as resolved.

# Create required directory
if [ ! -d "$NTP_DIR" ]; then
log "Creating $NTP_DIR"
mkdir -p "$NTP_DIR"
fi

# Create flag files
if [ ! -f "$NTP_FILE" ]; then
touch "$NTP_FILE" && log "Created $NTP_FILE"
Comment thread
sindhu-krishnan marked this conversation as resolved.
fi
Comment thread
sindhu-krishnan marked this conversation as resolved.

Comment thread
sindhu-krishnan marked this conversation as resolved.
if [ ! -d "$SYSTEMD_DIR" ]; then
log "Creating $SYSTEMD_DIR"
mkdir -p "$SYSTEMD_DIR"
fi
Comment thread
sindhu-krishnan marked this conversation as resolved.

if [ ! -f "$SYSTEMD_CLOCK" ]; then
touch "$SYSTEMD_CLOCK" && log "Created $SYSTEMD_CLOCK"
Comment thread
tdeva14 marked this conversation as resolved.
fi

echo "Synchronized" > /tmp/ntp_status
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.

exit 0
10 changes: 10 additions & 0 deletions recipes-support/chrony/files/chrony-tracking.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Chrony telemetry data collection service
ConditionPathExists=/opt/secure/RFC/chrony/chronyd_enabled

[Service]
Type=oneshot
ExecStart=/lib/rdk/chrony_tracking.sh
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.

[Install]
WantedBy=multi-user.target
10 changes: 10 additions & 0 deletions recipes-support/chrony/files/chrony-tracking.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Run chrony telemetry collection every 15 minutes

[Timer]
OnBootSec=120s
OnUnitActiveSec=15min
Unit=chrony-tracking.service
Comment thread
sindhu-krishnan marked this conversation as resolved.

[Install]
WantedBy=multi-user.target
29 changes: 29 additions & 0 deletions recipes-support/chrony/files/chrony.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Configuration values in this file are defaults and typically do not change.
#Server configurations are added at runtime as it may change based on the partner.

# The next option causes a message to be written to syslog when chronyd
# has to correct an error above 0.5 seconds (you can use any amount you
# like).
logchange 0.5

# Logging
logdir /opt/logs/chrony
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated
log measurements statistics tracking
Comment thread
sindhu-krishnan marked this conversation as resolved.
Outdated

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logdir /opt/logs/chrony requires the directory to exist; if it’s missing, chronyd may fail to start or fail to write logs as configured. Consider creating /opt/logs/chrony via the recipe (do_install), a systemd-tmpfiles entry, or an ExecStartPre step before chronyd starts.

Copilot uses AI. Check for mistakes.
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1.0 3


# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# This directive can be used
# to enable a mode in which the RTC is periodically set to the system
# time, with no tracking of its drift.
rtcsync

# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
Comment thread
tdeva14 marked this conversation as resolved.

include /etc/rdk_chrony.conf
10 changes: 10 additions & 0 deletions recipes-support/chrony/files/chrony_tracking.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
LOGFILE="/opt/logs/chrony.log"

timestamp=$(date "+%Y-%m-%d %H:%M:%S")

{
echo "$timestamp chrony telemetry:"
chronyc tracking
echo ""
Comment thread
sindhu-krishnan marked this conversation as resolved.
} >> "$LOGFILE"
18 changes: 18 additions & 0 deletions recipes-support/chrony/files/chronyd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=NTP client/server
Documentation=man:chronyd(8) man:chrony.conf(5)
Wants=nvram.service tr69hostif.service network-up.target
After=nvram.service tr69hostif.service network-up.target
Comment thread
sindhu-krishnan marked this conversation as resolved.
ConditionPathExists=/opt/secure/RFC/chrony/chronyd_enabled
#Conflicts=systemd-timesyncd.service
ConditionCapability=CAP_SYS_TIME
Comment thread
sindhu-krishnan marked this conversation as resolved.

[Service]
Type=forking
Comment thread
sindhu-krishnan marked this conversation as resolved.
PIDFile=/run/chrony/chronyd.pid
ExecStartPre=/lib/rdk/chrony-conf-update.sh
ExecStart=/usr/sbin/chronyd
Comment thread
sindhu-krishnan marked this conversation as resolved.
ExecStartPost=/lib/rdk/logMilestone.sh "NTP_CLIENT_STARTED"
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.

[Install]
WantedBy=network-up.target
Comment thread
sindhu-krishnan marked this conversation as resolved.
Comment thread
sindhu-krishnan marked this conversation as resolved.
3 changes: 3 additions & 0 deletions recipes-support/chrony/files/rdk_chrony.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Configuration values in this file may change dynamically via TR-181 parameters.
#server time.google.com iburst minpoll 10 maxpoll 12
#server time.xfinity.com iburst minpoll 10 maxpoll 12
Comment thread
tdeva14 marked this conversation as resolved.
Outdated
Loading