S50date: use ntpd -gq instead of ntpdate

This commit is contained in:
Calin Crisan 2019-09-28 23:35:46 +03:00
parent 0174585166
commit bbc21276af

View File

@ -2,7 +2,6 @@
PROG_DATE="/bin/date" PROG_DATE="/bin/date"
PROG_NTPD="/usr/sbin/ntpd" PROG_NTPD="/usr/sbin/ntpd"
PROG_NTPDATE="/usr/bin/ntpdate"
SYS_CONF="/etc/date.conf" SYS_CONF="/etc/date.conf"
BOOT_CONF="/boot/date.conf" BOOT_CONF="/boot/date.conf"
@ -46,7 +45,7 @@ set_current_date_http() {
} }
set_current_date_ntp() { set_current_date_ntp() {
cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ${PROG_NTPDATE} -t ${DATE_TIMEOUT} -s ${PROG_NTPD} -gq &>/dev/null
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
logger -t date "current system date/time set to $(date) via NTP" logger -t date "current system date/time set to $(date) via NTP"
return 0 return 0