1、新建shell脚本输入以下内容
#!/bin/sh appName="自己的jar包名称" echo "Try to stop running aplication [${appName}]" ids=`jps|grep ${appName}|awk '{print $1}'` for id in ${ids} do echo "Stop application on pid ${id}..." kill -9 ${id} done sleep 3s echo "Stop application successfully"
2、执行脚本