Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to start the jar package project under the Centos7 server

Shulou Source: shulou.com Published: 2022-06-01 20:26:32 11月14日 Update

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!

Tags: Project service article run server command file path value interest at the same time post-maintenance file name method more friends directory knowledge tape industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Shulou Tech Info Huawei Apple