original:
https://blog.csdn.net/boshuzhang/article/details/50696612
#!/bin/sh
NAME=$1
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
echo $ID
echo "---------------"
for id in $ID
do
kill -9 $id
echo "killed $id"
done
echo "------------ ---"
1), save it as killprocess.sh
2), call ./killprocess.sh programmename. Where programme can be the program name or the command line when starting the program, as long as all the processes corresponding to the program can appear after ps -ef | grep programmename