How to modify system service start and stop -- Linux

Source: Internet
Author: User
How to modify system service start and stop-Linux-general Linux technology-Linux technology and application information is as follows. Each time the system is started, different services are started based on different runlevel levels.

As we all know, Linux provides us with different startup levels in 7: 0 ~ 6. Which services will be started at different startup levels. You can use chkconfig -- list to check whether the chkconfig service name -- level 3 {on | of} needs to be started or stopped at a certain level.

1. For example, to stop the sshd service at the 3rd startup levels.

[Root @ team4 rc3.d] # chkconfig sshd -- level 3 off

2. You can also manually modify it. There are many directories corresponding to different runlevels in the/etc/rc. d/directory, which indicates to start and stop those services when entering a certain startup level.

For example:

[Root @ team4 etc] # ls/etc/rc. d
Init. d rc0.d rc2.d rc4.d rc6.d rc. sysinit
Rc rc1.d rc3.d rc5.d rc. local

We use the rc3.d directory as an example. The directory records the services that need to be stopped and started when init 3 is entered.

The contents of the rc3.d directory are as follows:

[Root @ team4 etc] # ls/etc/rc. d/rc3.d/
The K02avahi-dnsconfd K89pand S25bluetooth
K02dhcdbd K89rdisc S25netfs
K02NetworkManager K91capi S25pcscd
K02NetworkManagerDispatcher K99readahead_later S26apmd
K05conman S04readahead_early S26hidd

Start with "K" indicates the service to be stopped at the startup level. The number indicates the sequence of execution when the service is stopped, and the service is displayed later.

S starts with those services.

Note: first start with K and then start with S. Therefore, services starting with S will overwrite services starting with K.

If you want to modify the service, you only need to modify the file name.

For example
# Mv k89pand S89pand
# Reboot
The pand service is stopped.
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.