Today, the editor will teach you two simple and easy-to-understand methods for booting Linux, which is to set up the auto-start program at boot. The first method is to edit "/etc/rc.local" and enter the shell command to start the program; the second method is to register it as a system service. Interested friends can study with the editor, I hope it will be helpful to you.
How to start Linux on boot:
1./etc/rc.local
The rc.local is executed after all system initialization is completed, so we can write the startup script into it.
This is the simplest method. Edit "/etc/rc.local" and enter the shell command to start the program (the full path of the command must be entered).
rc.local starts with the root account by default. The method to start using other accounts is:
su - admin -c '/bin/sh /usr/local/rsync/rsync.sh'
2. Registration System services
The services that come with the operating system, such as ssh, ftp, etc., are automatically started at boot.
But if I want to add an installed service as a system service, I can execute the following command:
Put the startup script in the directory /etc/rc.d/init.d Next
chkconfig --add service name .
(Explanation, level 3 means starting in command line mode, level 5 means starting in graphical interface, on means turning on)
chkconfig -leve startup level service name off
For example: chkconfig -level 3 mysql on # You can also use chkconfig --del service name to delete system services
If you want to see which services have been added as system services, you can use the command:
chkconfig --list/chkconfig
If you want to check which programs have been added as self-starting, you can use the command:
cat /etc/rc.local (check which program paths have been added to this file)
Related tutorials:
Linux video tutorialThe above is the detailed content of What are the methods for booting Linux?. For more information, please follow other related articles on the PHP Chinese website!