Preface Everyone knows how to run a jar package on Linux. Why do I want to talk about it separately? Careful friends may have discovered the keywords Centos7 and best way in the title. This shows that I am not just writing something casually to write a blogヾ(◍°∇°◍)ノ゙ First of all, Centos7 recommends that we run the project like this First execute the command: cd /ets/systemd/system Go to this directory and create a new file yourProjectName.service. You can set yourProjectName to the service name you want. Edit a new file with vi vi yourProjectName.service file name [Unit] Description=yourProjectName #DescriptionAfter=syslog.target network.target #Depends on [Service] Type=simple ExecStart=/usr/bin/java -jar /opt/javaapps/yourProjectName.jar #The first part is the absolute path of the java command and the second part is the absolute path of the jar package. ExecStop=/bin/kill -15 $MAINPID User=root Group=root [Install] WantedBy=multi-user.target use systemctl start yourProjectName or systemctl start yourProjectName.service The service is started. If you change the project: Run first systemctl daemon-reload Then run To stop the service: systemctl stop yourProjectName or systemctl stop yourProjectName.service Set the startup to start automatically: systemctl enable yourProjectName or systemctl enable yourProjectName.service Or if you don't want to start the machine: systemctl disable yourProjectName or systemctl disable yourProjectName.service Okay, that's all. Running the project in a standardized manner helps with later maintenance. Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of CocosCreator message distribution mechanism
>>: Summary of common tool examples in MySQL (recommended)
Background: During the development process, we of...
This article records the installation tutorial of...
Table of contents HTTP hijacking, DNS hijacking a...
As a technical novice, I am recording the process...
Table of contents 1. Problem scenario 2. Cause An...
Dimensionality reduction of two-dimensional array...
Browser compatibility is nothing more than style ...
Today, when I searched for a page on Baidu, becaus...
Official website: http://code.google.com/p/zen-cod...
In Linux, everything is a file, so the Android sy...
Ⅰ. Problem description: Use CSS to achieve 3D con...
Copy code The code is as follows: <form action...
Server Status Analysis View Linux server CPU deta...
Table of contents Overview 1. RangeError 2. Refer...
To automatically load kernel modules in CentOS, y...