From b0f7965b3e2466f6b148b97d1000771c18e59382 Mon Sep 17 00:00:00 2001 From: sindhu-krishnan <102755514+sindhu-krishnan@users.noreply.github.com> Date: Tue, 18 Nov 2025 22:13:45 +0530 Subject: [PATCH 1/4] Update timesyncd-conf-update.sh --- lib/rdk/timesyncd-conf-update.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/rdk/timesyncd-conf-update.sh b/lib/rdk/timesyncd-conf-update.sh index a7b6eb65..8ebfda84 100755 --- a/lib/rdk/timesyncd-conf-update.sh +++ b/lib/rdk/timesyncd-conf-update.sh @@ -21,10 +21,12 @@ # Scope : RDK Devices # Usage : Invoke by systemd service -sleep_time=5 + output="" count=0 LOG_FILE="/opt/logs/ntp.log" +attempts=0 +max_attempts=2 if [ -f /etc/env_setup.sh ]; then . /etc/env_setup.sh @@ -48,11 +50,13 @@ fi } ntpLog "Retrive NTP Server URL from /lib/rdk/getPartnerProperty.sh..." -while [ ! "$hostName" ] && [ ! "$hostName2" ] && [ ! "$hostName3" ] && [ ! "$hostName4" ] && [ ! "$hostName5" ] +while [ ! "$hostName" ] && [ ! "$hostName2" ] && [ ! "$hostName3" ] && [ ! "$hostName4" ] && [ ! "$hostName5" ] && [ $attempts -lt $max_attempts ] do # NTP URL from the property file get_ntp_hosts sleep 5 + echo "Attempt $attempts - Failed to retrieve NTP server URL, attempting again..." + attempts=$((attempts + 1)) done partnerHostnames="$hostName $hostName2 $hostName3 $hostName4 $hostName5" @@ -92,8 +96,6 @@ if [ -f /etc/systemd/timesyncd.conf ];then # Restart the service to reflect the new conf ntpLog "Restarting the service: systemd-timesyncd.service ..!" - /bin/systemctl reset-failed systemd-timesyncd.service - /bin/systemctl restart systemd-timesyncd.service else ntpLog "No new Hostnames found to update /etc/systemd/timesyncd.conf" fi From 456e1f992307a4b6e2eaf14fd54b62200821a032 Mon Sep 17 00:00:00 2001 From: sindhu-krishnan <102755514+sindhu-krishnan@users.noreply.github.com> Date: Wed, 26 Nov 2025 15:43:38 +0530 Subject: [PATCH 2/4] Delete systemd_units/restart-timesyncd.service --- systemd_units/restart-timesyncd.service | 28 ------------------------- 1 file changed, 28 deletions(-) delete mode 100644 systemd_units/restart-timesyncd.service diff --git a/systemd_units/restart-timesyncd.service b/systemd_units/restart-timesyncd.service deleted file mode 100644 index 941e6812..00000000 --- a/systemd_units/restart-timesyncd.service +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################## -# If not stated otherwise in this file or this component's LICENSE file the -# following copyright and licenses apply: -# -# Copyright 2020 RDK Management -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# 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. -############################################################################## - -[Unit] -Description=Timesyncd restart for ENV NTP URL -After=local-fs.target -ConditionPathExists=/tmp/route_available - - -[Service] -ExecStart=/lib/rdk/timesyncd-conf-update.sh - From e457798ecdbf8ded5bda5b52c75fd66a91e9702b Mon Sep 17 00:00:00 2001 From: sindhu-krishnan <102755514+sindhu-krishnan@users.noreply.github.com> Date: Wed, 26 Nov 2025 15:44:00 +0530 Subject: [PATCH 3/4] Delete systemd_units/restart-timesyncd.path --- systemd_units/restart-timesyncd.path | 30 ---------------------------- 1 file changed, 30 deletions(-) delete mode 100644 systemd_units/restart-timesyncd.path diff --git a/systemd_units/restart-timesyncd.path b/systemd_units/restart-timesyncd.path deleted file mode 100644 index 698c4255..00000000 --- a/systemd_units/restart-timesyncd.path +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################## -# If not stated otherwise in this file or this component's LICENSE file the -# following copyright and licenses apply: -# -# Copyright 2020 RDK Management -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# 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. -############################################################################## - -[Unit] -Description=Timesyncd restart path -OnFailure=path-fail-notifier@%n.service - -[Path] -PathChanged=/tmp/route_available -Unit=restart-timesyncd.service - -[Install] -WantedBy=multi-user.target - From 94de24993b5215380884b6aad1942c28e3e3e01e Mon Sep 17 00:00:00 2001 From: sindhu-krishnan <102755514+sindhu-krishnan@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:45:21 +0530 Subject: [PATCH 4/4] Update timesyncd-conf-update.sh --- lib/rdk/timesyncd-conf-update.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/rdk/timesyncd-conf-update.sh b/lib/rdk/timesyncd-conf-update.sh index 8ebfda84..ea8b30ba 100755 --- a/lib/rdk/timesyncd-conf-update.sh +++ b/lib/rdk/timesyncd-conf-update.sh @@ -93,9 +93,6 @@ if [ -f /etc/systemd/timesyncd.conf ];then fi cat /tmp/timesyncd.conf > /etc/systemd/timesyncd.conf rm -rf /tmp/timesyncd.conf - - # Restart the service to reflect the new conf - ntpLog "Restarting the service: systemd-timesyncd.service ..!" else ntpLog "No new Hostnames found to update /etc/systemd/timesyncd.conf" fi