查看jenkin的进程id
ps -ef|grep jenkins.war|grep -v "grep"|awk '{print $2}'
执行结果参考:
[root@test-server-2 bin]# ps -ef|grep jenkins.war|grep -v "grep"|awk '{print $2}'
22950
shell脚本接收进程并杀死
#/bin/sh
taskId=`ps -ef|grep jenkins.war|grep -v "grep"|awk '{print $2}'`
echo $taskId
if [ -n "$taskId" ]; then
for id in $taskId
do
kill -9 $id
echo "killed $id"
done
fi
原创文章,作者:kirin,如若转载,请注明出处:https://blog.ytso.com/243927.html