123456789101112131415161718192021222324 |
- #!/usr/bin/sh
- if [ $# -ne 2 ] && [ $# -ne 3 ]
- then
- echo "Usage: start-port.sh app port [profile]"
- echo Example: ./start-port.sh demo-1.0.0.jar 8081 prod
- exit
- fi
- app=$1
- port=$2
- profile=$3
- if test $# -ne 3
- then
- profile=prod
- fi
- pid=`netstat -npa|grep LISTEN|grep $port|awk '{print $7}'|awk -F '/' '{print $1}'`
- if [ -z $pid ]
- then
- #nohup java -jar $app --server.port=$port --spring.profiles.active=$profile &
- nohup java -cp $app -Dloader.path=lib -Djava.libraray.path=lib -Dserver.port=$port -Dspring.profiles.active=$profile org.springframework.boot.loader.PropertiesLauncher &
-
- echo 'Start service ok!'
- else
- echo 'Error: service is started!'
- fi
|