#! /bin/bash port=8093 pid=`lsof -t -i:$port` echo "$pid" if [ $pid eq 0 ] then echo "api is already stopped" else kill -9 $pid echo "api is killed" fi java -jar -Xms512m -Xmx512m -Xmn200m -Xss256k api-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod &