- java jar package startup script
- Start according to the version number
Create script start.sh - content
#!/bin/bash
rx='^([0-9]+\.){0,2}(\*|[0-9]+)$'
if [[ $1 =~ $rx ]]; then
kill -9 `cat java.pid`
echo "running version is $1 "
java -Xms512m -Xmx1024m -server -jar -Dspring.profiles.active='test' mallplus-admin-$1.jar > log.txt 2>&1 &
echo "$!" > java.pid && tailf log.txt
else
echo "error! version is null"
fi
For example, the jar you type is test-admin.1.1.2.jar,
then use the script to add the version number and press Enter to start it.
./start.sh 1.1.2