jar package start and stop

The content of startTest.sh is as follows:

#!/bin/sh
java -jar Test.jar & #Note: There must be & let it execute in the background, otherwise no pid will be generated
echo $! > java.pid # Write the pid corresponding to the start of the jar package to the file, and provide the pid when it stops


The content of stopTest.sh is as follows:

#!/bin/sh
PID=$(cat java.pid )
kill -9 $PID

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326399179&siteId=291194637