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
Introduction The use of is null, is not null, and...
First, the principle of esp8266 publishes message...
Meta tag function The META tag is a key tag in th...
1. Background Use LDAP to centrally manage operat...
1. Data flows from QT to JS 1. QT calls the JS fu...
Table of contents background Importing virtual fi...
The bash history command in Linux system helps to...
The communication modes of vue3 components are as...
We know that there are two ways to receive incomi...
Table of contents Achieve results Available plugi...
The default varchar type in MySQL is case insensi...
I am using LDAP user management implemented in Ce...
Table of contents Development Environment Game en...
Box-sizing in CSS3 (content-box and border-box) T...
MySQL software installation and database basics a...