Pitfalls encountered during project deployment When deploying Zhihudemo, I did not use automated deployment tools such as Jenkins. I encountered a pit when deploying the jar package project in Linux CentOS. When I remotely connected to the server through xshell and used the "java -jar" command in the system to start the jar package, the output log would occupy the current terminal page. If I closed the terminal window, the entire Java program would stop. To solve this problem, I could set the jar package as a background service, and further set it as a system service and boot automatically. 1. Write a startup script The script can be stored anywhere. In this example, it is stored in /etc/rc.d/init.d/file-preview-server.sh # !/bin/bash # program # file preview server start export JAVA_HOME=/opt/jdk8 export JRE=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE/lib:. export PATH=$JAVA_HOME/bin/:$JRE/bin:$PATH nohup java -jar /root/file-preview-server/file-preview-server.jar > /root/file-preview-server/stdout.log & 2. Add execution permissions to the /etc/rc.d/init.d/file-preview-server.sh file chmod +x /etc/rc.d/init.d/file-preview-server.sh 3. Add execution permissions to the /etc/rc.d/rc.local file chmod +x /etc/rc.d/rc.local 4. Edit /etc/rc.d/rc.local file Add the following statement at the end of the file su - root -c '/etc/rc.d/init.d/file-preview-server.sh' Now, you’re done! The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: About the bug of better-scroll plug-in that cannot slide (solved by plug-in in 2021)
>>: MYSQL unlock and lock table introduction
Table of contents 1. Demand Background 2. Optimiz...
In development projects, we can monitor SQL with ...
Table of contents 1. Download 2. Deployment 3. Ng...
I have recently studied the hollowing effect. bac...
1. Purpose Write a Flask application locally, pac...
Originally, this seventh chapter should be a deep ...
What are Routing and Routing Table in Linux? The ...
Table of contents 1. What is scrapy_splash? 2. Th...
This article example shares the implementation of...
Apache Tika is a library for file type detection ...
1. Design source code Copy code The code is as fol...
Table of contents Preface Modifiers of v-model: l...
First, let's look at three situations where m...
<br />Green is between yellow and blue (cold...
Preface The database has always been my weak poin...