Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart NTP only if there is server information present in configuration #13

Closed
wants to merge 1 commit into from
Closed
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
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