Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to start the jar package project under the Centos7 server

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to start the jar package project under the Centos7 server, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

First of all, Centos7 recommends that we run the project this way.

First execute the command:

Cd / ets/systemd/system

To this directory, create a new yourProjectName.service, and you can set yourProjectName to the name of the service you think of

Edit a new file with vi

Vi yourProjectName.service

File name

[Unit] Description=yourProjectName # describes that After=syslog.target network.target # depends on [Service] Type=simple ExecStart=/usr/bin/java-jar / opt/javaapps/yourProjectName.jar # the absolute path of the java command is followed by 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

Run systemctl start sell.service again

To stop the service:

Systemctl stop yourProjectName

Or

Systemctl stop yourProjectName.service

Set Boot self-boot:

Systemctl enable yourProjectName

Or

Systemctl enable yourProjectName.service

Or you don't want to turn it on:

Systemctl disable yourProjectName

Or

Systemctl disable yourProjectName.service

All right, that's it. Running the project in a standardized way contributes to post-maintenance.

Thank you for reading this article carefully. I hope the article "how to start the jar package project under the Centos7 server" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report