How to set up automatic startup on Linux: 1. Add the automatic startup command "/usr/./hello.sh" or "cd /opt && ./hello" in the "/etc/rc.local" file .sh". 2. Add the self-starting script in the "/etc/init.d" directory.
#The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.
Execute the command: Edit "/etc/rc.local" and add your The command you want to run at startup
Run the program script: Then add the full path of the program to be executed in the last line of the file.
For example, if you want to execute a hello.sh every time you turn on the computer, and this script is placed under /usr, you can add a line "/usr/./hello." to "/etc/rc.local". sh", or " cd /opt && ./hello.sh "
Note that your command should be added before: exit 0
linux has many files under "/etc/rc.d/init.d", each file is What you can see is actually some shell scripts or executable binary files
When Linux boots up, it will load and run the programs in the /etc/init.d directory, so we can put the scripts we want to run automatically. Just go to this directory. The startup of system services is achieved in this way.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to set linux to start automatically at boot. For more information, please follow other related articles on the PHP Chinese website!