This is the first day of my participation in Gwen Challenge
Update jar package to remote server using SCP command
- Connect to remote server:
SSH [remote account name] @ [remote address]
-
CD Go to the directory where the specified JAR package is stored
-
Cp [jar package name] [New JAR package name] —– Back up the original JAR package to prevent errors in the new JAR package and roll back the version
-
Rm -rf [jar package name] —- Delete the JAR package
-
Exit —– Indicates the login status
-
SCP [root@jar] : / [root@jar] : / [root@jar] : / [root@jar] : / [root@jar] : /
For example: SCP ~ / workspance testSCP [email protected]: / home/chengqi/chengqi/zhonghua /
7) Log in again
8) netstat -ntlp —- View the current running ports9) kill -9 [port number] —– Find the port number occupied by the JAR package, as shown in figure 8081. The port number is 721110) Enter: java-jar —– restart the service —->> Same as the last step in another article introducing start.sh
Start the start.sh file on the remote server
- The server directory structure is as follows:
- Open the start.sh file as follows:
Nohup java-xdebug-xRUNjDWp :server= Y,transport=dt_socket,address=8989,suspend= n-jar sdkclient-0.0.2-snapshot.jar -Dspring.config.location=application.yml &
-
The following Settings are at the same directory level:
-
Nohup: Log setting. Logs are saved in the nohup.out file at run time.
-
Java-jar [jar package name] : starts the JAR package service
-
Xdebug: Supports remote debugging. After setting the port, you can break points on the local IDEA and view breakpoint logs
-
Remote breakpoint method: Edit Configuration –> Remote –> Host –> Port –> OK
-
As shown below:Address = [port number] : After the port is set, idea can be used to remotely service the server
Dspring.config.location = [application.yml] Sets the yML file dependency to be used by the server
- Start the
Go to the script directory and enter./start.sh to start the script
- This can also be done locally
In the script directory, right-click and use terminal to open:
Enter java-jar (jar package name) as follows: If the preceding code is displayed, the startup is successful. You can then access the service.
Don’t get lost oh ~