123456789101112131415161718192021222324252627282930 |
- #!/bin/sh
- ROOT=$(cd `dirname $0`/../../; pwd)
- cd $ROOT
- APP_NAME=blackbox-insert
- JAVA_HOME=$ROOT/jdk8
- JAR_NAME=$ROOT/lib/insert-app-0.0.1-SNAPSHOT.jar
- #PID 代表是PID文件
- PID=$ROOT/pid/$APP_NAME\.pid
- get_pid(){
- pid=`ps -ef|grep $JAR_NAME|grep -v grep|awk '{print $2}' `
- #如果不存在返回1,存在返回0
- if [ -z "${pid}" ]; then
- return 1
- else
- return 0
- fi
- }
- get_pid
- if [ $? -eq "0" ]; then
- echo ">>> ${JAR_NAME} is running PID is ${pid} <<<"
- #ps -fT -p ${pid}
- top -H -p ${pid}
- else
- echo ">>> ${JAR_NAME} is not running <<<"
- fi
- exit 0
|