杀死启动进程

一、kill进程

#!/bin/bash
PID=$(ps -ef | grep seps-web-1.0-SNAPSHOT.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
    echo Application is already stopped
else
    echo kill $PID
    kill $PID
fi

二、启动进程

#!/bin/bash
PID=$(ps -ef | grep hybrid-cloud-application.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
    nohup java -Dsun.misc.URLClassPath.disableJarChecking=true -Dfile.encoding=UTF-8 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9043 -jar hybrid-cloud-application.jar --spring.config.location=./application.properties &
else
    echo Application is already started
fi
原文地址:https://www.cnblogs.com/y593216/p/13476223.html