Here I will show you the NTP configurations which must be done to make sure NTP itself syncs the hwclock with local clock during system startup and you need not worry about any more manual configurations.
If you are using HP ProLiant Blade servers then it is always recommended to set the BIOS date and time using SNTP or else for all other hardware make sure your BIOS is pointing to correct date and time.
Exit the below file and change SYNC_HWCLOCK to "yes"
# Options for ntpdate
OPTIONS="-p 2"
# Number of retries before giving up
RETRIES=2
# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=yes
Next add the list of your NTP servers in the below file
1.in.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
This file will be referenced by ntpdate service , below is the content of ntpdate.service
# /usr/lib/systemd/system/ntpdate.service
[Unit]
Description=Set time via NTP
After=syslog.target network.target nss-lookup.target
Before=time-sync.target
Wants=time-sync.target
[Service]
Type=oneshot
ExecStart=/usr/libexec/ntpdate-wrapper
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Here as you see the script calls "/usr/libexec/ntpdate-wrapper" which calls "ntpstep=/etc/ntp/step-tickers" to make sure ntp syncs hwclock
Next enable the ntpdate service to make sure it is called at next reboot
NOTE: As long as NTPD daemon is running, you will not be able to start ntpdate service
If you wish to start ntpdate service runtime then you have two options
1. Disable ntpd service and then start ntpdate.service
2. Execute ntpdate using -u variable, with this the service will be called using random port number
To stop NTPD daemon
Next start ntpdate service
Next again start ntp service
OR you can execute below command (Here replace the 1.in.pool.ntp.org with your NTP server)
27 Apr 20:38:59 ntpdate[13893]: adjust time server 1.in.pool.ntp.org offset -0.004723 sec
I hope the article was useful.