Is there any supported way to check via the command line when the system clock was last synchronized?
Currently, we are having an issue with a script that runs at startup. We have a TRB that is switched off at sunrise and switched on at sunset. At sunset, before NTP has synchronized, the clock is briefly around 12 hours behind.
We would like to check whether NTP has been synchronized since boot to avoid starting the script with the wrong time set.
Based on your setup, there are a couple of CLI commands you can use to check the NTP synchronization status on your TRB145.
The most straightforward approach is to filter the system log for NTP-related entries:
logread | grep ntpclient
This will display all events associated with the NTP client service, including any synchronization attempts and errors.
To monitor NTP activity in real time - for example, immediately after boot — you can use:
logread -f | grep ntpclient
Regarding your startup script timing issue: the device first attempts to obtain the time from the cellular operator network (modem-based time source) before falling back to NTP servers. If the modem time source is unavailable or returns an error, there may be a brief window at boot where the clock is not yet accurate.
To guard against this in your script, you can implement a simple polling loop that waits until the system year is valid before proceeding:
#!/bin/sh
while [ "$(date +%Y)" -lt "2026" ]; do
sleep 5
done
# your script logic starts here
Additionally, we recommend reviewing the NTP configuration under Services → NTP in the WebUI to confirm that reliable public NTP servers (e.g., pool.ntp.org) are configured as fallback sources, as this will improve time synchronization reliability after boot.
Please let us know if you have any further questions or if you need assistance with the configuration.
thanks for the reply, but unfortunately this does not solve our issue, since doing logread | grep ntpclient on TRB 145 TRB1_R_00.07.07.3 don’t output any line, even if the TRB is configured for updating NTP every 24 hours. Is it possibile that the logging is disabled by default? How can we enable it?
Could you please clarify whether there is a specific reason for using an older firmware version? Several improvements and fixes related to the NTP service have been introduced in more recent releases.
For testing purposes, would it be possible to upgrade the device to the latest / latest stable firmware version? Firmware files can be downloaded here:
When performing the upgrade, please ensure that the Keep Settings option is disabled. Given the significant version gap, certain configuration parameters may have changed, and retaining settings could lead to improper behavior after the update.
Additionally, we recommend exporting a configuration backup prior to the upgrade so it can be restored if needed in case the test does not produce the expected results.
We are currently not upgrading firmware in the field beacuse we have developed a custom service that runs on the TRB and we want to avoid breaking it. We tried one of the last firmware and we have compatibility problems so we are postponing the mass upgrade.
So it is implied that is not working on TRB1_R_00.07.07.3 the command you referenced?
Please note that Teltonika R&D does not provide fixes, feature changes, or logging improvements for older firmware branches. All ongoing development, improvements, and service behavior updates are implemented only in the latest stable firmware releases.
For this reason, if you are investigating NTP synchronization behavior or related diagnostics, the issue must be verified using the latest available firmware for TRB145.
If the behavior is still present after updating, please provide the firmware version and configuration details, and we will assist you further.