Below "ntpstat" command can be used to check NTP status on Linux Machine.
Below is sample output of above command.
From above command will report the synchronisation state of the NTP daemon running on the local machine. As seen from above output it is synchronized.
"echo $?" command will show the exit status of ntpstat command. Below are 3 exit status we can see.
In the example shown above exit status is 0 as the clock is synchronized.
ntpstat;echo $?
Below is sample output of above command.
# ntpstat;echo $?
synchronised to NTP server (192.168.20.1) at stratum 5
time correct to within 132 ms
polling server every 1024 s
0
synchronised to NTP server (192.168.20.1) at stratum 5
time correct to within 132 ms
polling server every 1024 s
0
From above command will report the synchronisation state of the NTP daemon running on the local machine. As seen from above output it is synchronized.
"echo $?" command will show the exit status of ntpstat command. Below are 3 exit status we can see.
- exit status 0 – Clock is synchronised.
- exit status 1 – Clock is not synchronised.
- exit status 2 – If clock state is indeterminant, for example if ntpd is not contactable.
In the example shown above exit status is 0 as the clock is synchronized.
Products to which Article Applies
All Linux environments
Additional References
https://www.cyberciti.biz/faq/linux-unix-bsd-is-ntp-client-working/
tarun boyella
No comments:
Post a Comment