Each time the system is started, different services are started based on different runlevel levels. This article will show you how to modify and view the startup service of linux. Press [CTRL] + [ALT] + [F7]/[F8] to view the services that are being started at system startup !!!! As we all know, each time a Linux system is started, different services are started at different runlevel levels. This article will show you how to modify and view the startup service of linux.
Press [CTRL] + [ALT] + [F7]/[F8] to view the services that are being started at system startup !!!!
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.
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:
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.
Linux setup program boot and Linux services
Here, I will only talk about what I know, for example:
The requirement is that I want to connect to the Linux Server using the VNC Viewer in Windows. I enter
# Vncserver
After setting the password, now I can use VNC in Windows to connect to the Linux desktop. if my Linux Server system restarts, I have to re-run the vncserver command, so now I want the Linux Server to automatically start the vncserver at startup.
What are the methods?
1. I can set the vncserver as a system service and start it. run the following command to check whether the vncserver is already a system service.
# Chkconfig -- list | grep vnc
Vncserver 0: off 1: off 2: off 3: off 4: off 5: off 6: off
Now we want to set the vncserver to start automatically after it is started. run the following command:
# Chkconfig -- level 5 vncserver on # chkconfig -- list | grep vnc
Vncserver 0: off 1: off 2: off 3: off 4: off 5: on 6: off
Restart the system at this time, and the vncserver will automatically get up as a service. However, if you want to use vnc now, directly press the Command vncserver.
2. we can write the vncserver command in the script to be run when Linux is started. what scripts will be executed when Linux is started?
I know the following:
/Etc/rc. local
/Etc/rc. sysinit
/Etc/inittab
/Etc/profile
Remember the differences and connections between Linux and Linux boot.
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.