If your application requires your SAP Cloud Platform virtual machine clock to show the correct time, there is a way to achieve that thanks to a basic set of commands. The goal is to synchronize the clock with the network time servers using the Network Time Protocol (NTP).
Let’s assume you’ve already established an SSH connection with your virtual machine. Just follow these steps:
1. To immediately synchronize the clock, execute the following command:
ntpdate -u <NTP server IP>
Here is the list with the IPs of the three currently available regions in the Neo environment where you can run SAP Cloud Platform virtual machines:
For example, if my virtual machine is running on the US East (Sterling) SAP Cloud Platform region, I have two options. I can run one of the following two commands:
ntpdate -u 147.204.72.22
or
ntpdate -u 147.204.72.23
2. Check whether the clock is synchronized by executing:
date
Now that the time is updated, you can make sure it stays in sync in the long run by completing a few more steps.
1. Check the current NTP server configurations. Execute:
cat /etc/ntp.conf
You need to update the server configurations listed there by adding the server IPs of the SAP Cloud Platform region where your virtual machine is running.
2. Edit the
ntp.conf file and add all IPs for the corresponding region:
For example, I’ve used the vi editor to add the Europe (Rot) server IPs, because my virtual machine is running in the Europe (Rot) region:
3. Check the state of the daemon by executing:
systemctl status ntpd
Then:
- If the daemon is disabled, run the following commands:
systemctl enable ntpd
systemctl start ntpd
- If the daemon is enabled but currently stopped, run:
systemctl start ntpd
In general, it shouldn’t take long for the configuration changes to be applied.
If you have any feedback, go ahead and share it in the comments section below.