#!/bin/sh TOM_HOME=$1 ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill if [ $? -eq 0 ];then kill -9 `ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill|awk '{print $2}'` else echo $TOM_HOME' No Found Process' fi
使用时,保存成文件,比如killps.sh 。然后killps 进程名即可
#!/bin/sh TOM_HOME=$1 ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill if [ $? -eq 0 ];then kill -9 `ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill|awk '{print $2}'` else echo $TOM_HOME' No Found Process' fi