How to set up service auto-start under CentOS

Source: Internet
Author: User

In the case of CentOS or redhat other systems, the system will not start automatically after installation, such as httpd, mysqld, postfix, etc., if the service is installed later. Even if the service is started manually by/etc/init.d/mysqld start, the service will not start automatically as long as the server restarts.

at this time, we need to set up after the installation, let the system automatically start these services, to avoid unnecessary loss and trouble.

In fact, the command is very simple, use chkconfig can. For example, to set the mysqld to boot automatically:

#chkconfig mysqld on

In the same vein, to cancel a service auto-start, you only need to change the last parameter "on" to "Off". For example, to cancel the auto-start of postfix:

#chkconfig postfix off

It is important to note that if the service has not been added to the Chkconfig list, it is now necessary to add it using the –add parameter:

#chkconfig –add Postfix

If you want to query all currently started services automatically, you can enter:

#chkconfig –list

But it shows too many things and looks dizzy. What if you want to see only the services you specify? This time only need to add the service name after the "–list", such as to see if the HTTPD service is automatically started, enter:

#chkconfig –list httpd

The result of this time output:

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

When the 0~6 is off, the HTTPD service does not start automatically when the system starts. After we enter Chkconfig httpd on, check again that the output is changed to:

httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

This time the 2~5 is on, which indicates that it will start automatically.


How to set up service auto-start under CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.