#! /bin/bash # springboot的jar放同级目录下即可,只能有一个jar文件 export PATH=$JAVA_HOME/bin:$PATH CURRENT_PATH=$(cd $(dirname $0); pwd) JAR=$(find $CURRENT_PATH -maxdepth 1 -name *.jar) PID=$(ps -ef | grep $JAR | grep -v grep | awk '{ print $2 }') case $1 in start) if [ ! -z $PID ]; then