rc.local method1 First create a script to start automatically vi /etc/scripts/createFile.sh #!/bin/bash #Start up and create a folder mkdir /opt/ccc 2. Grant execution permissions chmod 777 createFile.sh 3. Add the absolute path of the script in the /etc/rc.d/rc.local file 4. Give rc.local execution permissions chmod 777 rc.local Restart the service and find that a ccc folder has been created under the opt path View the script progress ps -ef | grep createFile chkconfig method1. Create a startup script vi createjava.sh #!/bin/bash #chkconfig: 2345 88 99 #description:auto_run #Start up and create a java file touch /opt/nihao.java #!/bin/sh This means that this script uses /bin/sh to interpret and execute #chkconfig: 2345 88 99 2345 means that this service is started when the system operation level is 2, 3, 4 or 5. 88: is the startup priority. 99: is the shutdown priority. Note: If the startup priority is configured too small, such as 0, the startup may fail because the network service it depends on may not be started at this time, resulting in a self-start failure. #description:createjava.sh Is the description information 2. Grant executable permissions chmod u+x createjava.sh 3. Copy the script to the /etc/init.d directory cp createjava.sh /etc/init.d/ 4. Add to service chkconfig --add /etc/init.d/createjava.sh 5. Restart the server init 6 The nihao.java file has been created This concludes the article about two ways to enable Linux startup services. For more information about Linux startup services, please search previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: This article teaches you how to play with CSS combination selectors
>>: How to implement input checkbox to expand the click range
MQTT Protocol MQTT (Message Queuing Telemetry Tra...
This article shares with you the installation of ...
Preface The basic principle of MySQL master-slave...
This article uses examples to explain the princip...
Problem: When using JDBC to connect to the MySQL ...
Introduction to HTML HyperText Markup Language: H...
This article shares the specific code of JavaScri...
This article refers to the work of 51CTO blog aut...
Table of contents 1. Original Definition 2. JS op...
Table of contents 1. Add attributes 2. Merge mult...
Use HTML to create complex tables. Complex tables...
Based on theories such as Saussure's philosop...
This blog post is about a difficulty encountered ...
Table of contents 1. What is an Operating System ...
Docker is an open source container engine that he...