Centos startup Item setting command: chkconfig

Source: Internet
Author: User

In other centos or RedHat systems, if services are installed later, such as httpd, mysqld, and Postfix, the system will not start automatically after installation. Even if you manually run/etc/init. d/mysqld start to start the service, the system will not start the service automatically after the server is restarted.

At this time, we need to set up after installation so that the system can automatically start these services to avoid unnecessary losses and troubles.

In fact, the command is very simple.ChkconfigYou can. For example, you need to set mysqld to automatically start upon startup:

#chkconfig mysqld on

 

Similarly, to cancel Automatic startup of a service, you only need to change the "on" parameter to "off. For example, to cancel Automatic Start of Postfix:

#chkconfig postfix off

 

It is worth noting that if this service has not been added to the chkconfig list, you need to add it using the-add parameter:

#chkconfig –add postfix

 

Delete a service from the system startup Item List and use the-del option to delete it from the startup list:

#chkconfig --del ip6tables

 

To query all the automatically started services, enter:

#chkconfig –list

 

However, this shows that there are too many things and it looks dizzy. What if I only want to view the specified service? In this case, you only need to add the service name after "-list". For example, to check whether the HTTPd service is automatically started, enter:

#chkconfig –list httpd

 

Output result at this time:

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

 

At this time, 0 ~ If both are off, the HTTPd service will not be automatically started when the system starts. After entering chkconfig httpd on, we will check again that the output result is:

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

 

2 ~ If all five are on, it indicates that it will be automatically started.

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.