img

Linux Restart NTPD Service Command

September 8, 2019

I am using Network Time Protocol daemon called NTPD on a Linux operating systems. How do I restart NTPD server or service on a Debian/Ubuntu / RHEL / Red Hat Enterprise / Fedora / CentOS Linux operating systems?

On Linux Network Time Protocol service name can be any one of the following:

  1. ntpd (default on most distro)
  2. xntpd
  3. openntpd


After changes of the NTP configuration file such as ntp.conf, the NTP service needs to be restarted. The exact command depending on your Linux distribution.

Debian / Ubuntu Linux restart ntp service

Use any one of the following command on Debian or Ubuntu Linux for ntpd (older version):
$ sudo /etc/init.d/ntp restart
OR use service command:
$ sudo service ntp restart
If you are using Ubuntu Linux 16.04+ LTS/Debian 9.x+ systemd based distro, use the following command:
$ sudo systemctl restart ntp
To see the status of your ntp service run:
$ systemctl status ntp
Sample outputs:

* ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: active (running) since Mon 2017-10-30 08:57:22 UTC; 23h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13976 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS)
  Process: 13988 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)
    Tasks: 1
   Memory: 2.7M
      CPU: 14.410s
   CGroup: /system.slice/ntp.service
           ??14005 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 114:120

CentOS /RHEL / Red Hat Enterprise Linux v4.x/5.x/6.x restart ntp service

Use any one of the following command on CentOS or REHL for ntpd::
$ sudo /etc/init.d/ntpd restart
OR use service command:
$ sudo service ntpd restart
If you are using RHEL/CentOS Linux version 7.x+ or latest version of Fedora Linux, use the following command:
$ sudo systemctl restart ntpd
Verify that ntpd restarted, type the following systemctl command:
$ systemctl status ntpd
Sample outputs from failed ntpd restart command:

* ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2017-10-31 08:37:52 UTC; 3s ago
  Process: 6063 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 6064 (code=exited, status=255)
 
Oct 31 08:37:52 centos-7 ntpd[6064]: Listen and drop on 1 v6wildcard :: UDP 123
Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 2 lo 127.0.0.1 UDP 123
Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 3 eth0 10.98.222.3 UDP 123
Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 4 lo ::1 UDP 123
Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 5 eth0 fe80::216:3eff:fed0:e88a UDP 123
Oct 31 08:37:52 centos-7 ntpd[6064]: Listening on routing socket on fd #22 for interface updates
Oct 31 08:37:52 centos-7 ntpd[6064]: 0.0.0.0 c016 06 restart
Oct 31 08:37:52 centos-7 systemd[1]: ntpd.service: main process exited, code=exited, status=255/n/a
Oct 31 08:37:52 centos-7 systemd[1]: Unit ntpd.service entered failed state.
Oct 31 08:37:52 centos-7 systemd[1]: ntpd.service failed.

A note about OpenNTPD service

If you are using OpenNTPD on Linux, type the following command to restart openntpd on Linux:
$ sudo /etc/init.d/openntpd restart
OR use service command:
$ sudo service openntpd restart

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Article Tags:
Article Categories:
How To

Comments are closed.