Skip to content

Commit

Permalink
Restart NTP only if there is server information present in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
gpunathilell committed Aug 13, 2024
1 parent 72b2f79 commit fc1cb0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion files/image_config/ntp/ntp-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ get_database_reboot_type
echo "Disabling NTP long jump for reboot type ${reboot_type} ..."
modify_ntp_default "s/NTPD_OPTS=\"-g -N\"/NTPD_OPTS=\"-x -N\"/"

systemctl --no-block restart ntp
#Check for NTP_KEYS or NTP_SERVERS in CONFIG_DB
ntp_config=$(redis-cli -n 4 keys *NTP_*)
if [ -n "$ntp_config" ]; then
echo "Server information present in CONFIG_DB, NTP is restarted"
systemctl --no-block restart ntp
else
echo "No server information present in CONFIG_DB, NTP is not restarted"
fi


1 change: 0 additions & 1 deletion files/image_config/ntp/sonic-target.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[Unit]
BindsTo=sonic.target
After=sonic.target

0 comments on commit fc1cb0c

Please sign in to comment.