Main Menu

Search

Showing posts with label ntp command. Show all posts
Showing posts with label ntp command. Show all posts

LINUX: How to Check if NTP Service Is Running in Linux? ("ntpd" command)

To Verify is NTP service is running on Linux machine, below command can be executed to check if ntpd service is running.
service ntpd status

If NTP daemon is running you should see output as follows:


ntpd (pid  <PID>b) is running...


Products to which Article Applies


All Linux environments

Additional References

https://www.thegeekdiary.com/linux-os-service-ntpd/

LINUX: How To Check NTP Status on Linux Machine? ("ntpstat" command)

Below "ntpstat" command can be used to check NTP status on Linux Machine.

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

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/