linux 下查杀进程

#!/bin/bash

name=$1
_check_pid=$2   
kr=1

while [ $kr == 1 ];do
	log "_check_pid will was killed"
    kill -9 $_check_pid 
    kr=$?

	proc=0
	IDS=`ps -ef | grep "$_check_pid" | grep "$name" | grep -v "grep" | awk '{print $2}'`
	for id in $IDS 
	do  
		if [ "$id" ==  "$_check_pid" ];then
			proc=1
		fi  
	done
	if [ $proc == 0 ];then
		kr=0
	fi
done

你可能感兴趣的:(linux 下查杀进程)