Setting up NTP service to Automatic restart

1

Setting up NTP service to Automatic restart which one should set to on in given list

ntpd 0:off  1:off   2:off   3:off   4:off   5:off   6:off 

mahendra kamble

Posted 2016-12-09T12:07:14.337

Reputation: 115

Answers

2

ntpd is an example of a daemon, sometimes called a service in come circles.

Run levels are not connected to the idea that if you shut down a daemon like ntpd, a second watchdog service will turn it back on. If what you mean by "Automatic restart" is "turn on a daemon after it has died by accident," I recommend you look at watchdog or something similar.

You can also set up a daemon to start when a machine boots up. This is often accomplished using run levels.

In the example you have provided you have listed ntpd and the seven run levels:

ntpd 0:off  1:off   2:off   3:off   4:off   5:off   6:off 

In the example ntpd is currently off. It will not start at any of those run levels.

The numbers 0 through 6 refer to runlevels. As the machine enters a run level, services at that run level are started.

The runlevel command will give you first the previous run level, then the current run level. (It will on CentOS and Ubuntu, at least).

[centos@ip-10-100-3-23 ~]$ runlevel
N 3
[centos@ip-10-100-3-23 ~]$ 

This command shows that this machine is currently at run level 3.

The way to change the run level depends on which OS and which version of that OS you are running. For CentOS 6, the command chkconfig --level 3 ntpd on will turn on ntpd to start at run level 3. In the example below, I configure ntpd to start on entering run level 3. I then revert that change and turn it off.

[root@host ~]# chkconfig --list ntpd
ntpd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@host ~]# chkconfig --level 3   ntpd on
[root@host ~]# chkconfig --list ntpd
ntpd            0:off   1:off   2:off   3:on    4:off   5:off   6:off
[root@host ~]# chkconfig --level 3   ntpd off
[root@host ~]# chkconfig --list ntpd
ntpd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@host ~]# 

StandardEyre

Posted 2016-12-09T12:07:14.337

Reputation: 348

2

Typically ntpd is run at runlevels 2, 3, 4 and 5. If you just use chkconfig ntpd on to set it on for these default runlevels.

gogators

Posted 2016-12-09T12:07:14.337

Reputation: 1 183