[root@localhost ~]# cat x2.sh #!/bin/bash rm -rf javaweb appname=$1 pid=`ps -ef | grep $appname | grep 'java -jar' | awk '{printf $2}'` echo $pid if [ -z $pid ]; then echo "$appname not started" else kill -9 $pid echo "$appname stoping..." check=`ps -ef | grep -w $pid | grep java` if [ -z $check ]; then echo "$appname pid:$pid is stop" else echo "$appname stop failed" fi fi
gitLab hook配置
标签:Java,appname,grep,ef,pid,echo,Maven,Jenkins From: https://www.cnblogs.com/wangfx/p/17297046.html