#!/bin/sh
#根据进程名杀死进程
#FileName: killjavaphprm.sh

#查看php进程ID
echo "php进程ID:"
pgrep php

#杀死所有php进程
echo "杀死所有php进程"
killall php

#删除log日志文件
#echo "删除所有以log开头的日志文件"
rm log*

echo "显示文件"
ls

#杀死传入的进程名
echo "杀死传入的进程名称对应的ID:"
if [ $# -lt 1 ]
then
echo "缺少参数:procedure_name"
exit 1
fi

PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'`
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done

posted on 2017-06-09 10:50  阚壠  阅读(325)  评论(0编辑  收藏  举报