Main Website | Billing Panel
Ukraine: +38 (044) 331-14-39, Russia: +7 (499) 638-51-83
Knowledgebase
Adding a Service to Autostart (CentOS 6/7)
Posted by Alexei V. on 15/03/2015 16:43

CentOS 6

To add a service to autostart, there is chkconfig service. By default, freshly installed CentOS distribution package includes many additional services.

The syntax of the service:

chkconfig --list service_name

chkconfig --add service_name

chkconfig --del service_name

chkconfig [--level levels] service_name <on|off|reset>

chkconfig [--level levels] service_name

You can see loadable services with the following command:

chkconfig --list | grep on

Check whether httpd is included in autostart:

chkconfig --list httpd

Set performance level 3 and check:

chkconfig --level 3 httpd on

Enable the service at all levels:

chkconfig httpd on

RedHat Linux distribution packages such as CentOS, Fedora includes SysV Init, which consists of 6 levels of system boot (runlevels).

0 — Halt

1 — Single-user text mode

2 — Not used (user-definable)

3 — Full multi-user text mode

4 — Not used (user-definable)

5 — Full multi-user graphical mode (with an X-based login screen)

It is recommended to enable services at the 3rd .

CentOS 7

To set a service to start on boot you can use systemctl:

systemctl enable httpd.service

To make sure a service does not start on boot:

systemctl disable httpd.service

You can check if a service is enabled or disable:

systemctl status httpd.service
(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).