PATH=$PATH:$JAVA_HOME/bin
NAME=$1
VERSION=$2
PORT=$3
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
for id in $ID
do
kill -9 $id
echo "killed $id"
done
nohup java -server -Xms600m -Xmx600m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -Xverify:none -XX:+DisableExplicitGC
-Djava.awt.headless=true -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=$PORT,suspend=n -Duser.timezone=Asia/Shanghai
-Denv=fat -Dapollo.cluster=vmfat03 -jar $NAME-$VERSION.jar > $NAME.log 2>&1 &
The script is shown in the figure, which is a very common one. However, if I add a remote port when I start, an error will be reported when I run the script next time
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
The remote port is occupied, but I have obviously killed the process, and the command query has also been killed.
After guessing whether it will take some time for the remote connection port to close completely after killing the process, but at this time, you use the same port number to start the remote debug mode, which will lead to the error shown in the figure above, so I’ll sleep 1 behind the done in the script. Let him wait 1s.
The result proved that the conjecture was correct, and then no such error was reported
Read More:
- Java jar close startup script
- HBase hangs up immediately after startup. The port reports an error of 500 and hmaster aborted
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- The error record when docker starts Nacos, and the solution to the problem of port occupation
- Kafka opens JMX port and reports that the error port is occupied
- Zip to decompress the jar package, like the add file in the jar package
- Depending on the custom component jar package, unable to read meta data for class appears after startup
- Dca1000 reports an error and the SPI port cannot be connected
- The python script tool of ArcGIS reports an error: indentationerror: unexpected indent solution
- Vscode remote connection server reports an error: could not establish connection to “XXXXXX” [resolved]
- Does the version of idea2020.1 import mybayis jar package or report an error? Error: (4,28) Java: package org.apache.ibatis.io does not exist
- Raspberry pie startup self startup opencv program script and error analysis
- Failed to get the resources path in the jar package, reporting an error null pointer
- Vue Alain startup command yarn serve reports an error
- [shell] sh executes the script and reports an error syntax error: “(” unexpected “)
- Idea2021 reports an error. Default operand size is 64 sets the startup task to automatically add the registry
- Vue project reports an error on ie11 white screen. Script1002: syntax error
- When Maven hits the jar package, an error is reported when executing install, and the symbol cannot be found in a line
- RabbitMQ Startup Script (How to Set)
- Vue executes NPM run Dev and reports an error: missing script: dev