Centos7.3 automatically starts or executes specified commands when booting

Centos7.3 automatically starts or executes specified commands when booting

In centos7, the permissions of the /etc/rc.d/rc.local file have been reduced and there is no execution permission. You need to add executable permissions to it.

chmod +x /etc/rc.d/rc.local

Then you can add the command you want to start automatically.

vi /etc/rc.d/rc.local

Additional knowledge: centOS7.2 sets the custom script as a service and starts it at boot

When the spring boot jar package is deployed online, it is hoped that it can be set as a service and started at boot. The steps are as follows:

1. Prepare the script (there are many on the Internet, so I won’t write it here)

2. Create a soft link to the /etc/rc.d/init.d directory

ln -s /springboot/biz /etc/rc.d/init.d

Source file (absolute path) Target path (absolute path)

3. Add execution permissions:

chmod +x biz

4. When executing service abc start, if an error is reported:

line 4: exec: java: not found

Then check the script and add the full path of java as follows:

exec /usr/java/jdk1.8.0_20/jre/bin/java -Xms128m -Xmx1024m -jar

5. Execute service biz start again and it starts successfully

6. Set the startup and modify the script. Add the following to the second line:

# chkconfig: 2345 99 99

7. Add startup:

chkconfig --add biz

chkconfig biz on

The above article about how to automatically start or execute specified commands on Centos7.3 at startup is all I want to share with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Automatically load kernel module overlayfs operation at CentOS startup
  • Three methods to modify the hostname of Centos7
  • Detailed explanation of the basic use of centos7 firewall in linux

<<:  Native JS implements a very good-looking counter

>>:  Summary of commonly used SQL statements for creating MySQL tables

Recommend

How to use the concat function in mysql

As shown below: //Query the year and month of the...

CSS3 implementation example of rotating only the background image 180 degrees

1. Mental Journey When I was writing the cockpit ...

CSS3 realizes the animation of shuttle starry sky

Result: html <canvas id="starfield"&...

How to implement remote automatic backup of MongoDB in Linux

Preface After reading the previous article about ...

Vue3.0 handwriting magnifying glass effect

The effect to be achieved is: fixed zoom in twice...

Detailed explanation of the murder caused by a / slash in Nginx proxy_pass

background An nginx server module needs to proxy ...

A Brief Analysis of Patroni in Docker Containers

Table of contents Create an image File Structure ...

Tutorial on installing MYSQL8.X on Centos

MySQL installation (4, 5, 6 can be omitted) State...

Example code of how to create a collapsed header effect using only CSS

Collapsed headers are a great solution for displa...

JavaScript to achieve fixed sidebar

Use javascript to implement a fixed sidebar, for ...

Basic operations of mysql learning notes table

Create Table create table table name create table...

How to create a virtual environment using virtualenv under Windows (two ways)

Operating system: windowns10_x64 Python version: ...

Detailed explanation of the use of Vue h function

Table of contents 1. Understanding 2. Use 1. h() ...

Detailed explanation of MySQL high availability architecture

Table of contents introduction MySQL High Availab...