Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions lib/rdk/timesyncd-conf-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -89,11 +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 ..!"
/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
Expand Down
30 changes: 0 additions & 30 deletions systemd_units/restart-timesyncd.path

This file was deleted.

28 changes: 0 additions & 28 deletions systemd_units/restart-timesyncd.service

This file was deleted.