Calendar
数据载入中,请稍候......
Placard
数据载入中,请稍候......
Category
数据载入中,请稍候......
Latest Entries
数据载入中,请稍候......
Latest Comments
数据载入中,请稍候......
Last Messages
数据载入中,请稍候......
User Login
数据载入中,请稍候......
Links
Information
数据载入中,请稍候......
Search
Other


Welcome to my blog!
  删除指定进程名
  #!/bin/bash
#kill process
HOLD1=tmp/hold1.$$
PORCESS=$1
usage(){
echo "Usage:`basename $0` process_name"
exit 1
}
if [ $# -ne 1 ];then
 usage
fi
case $1 in
*)
 ps x|grep "$PORCESS"|grep -v "grep"|grep -v "$0"|awk '{print $1"\t"$5}' >$HOLD1
;;
esac
if [ ! -s $HOLD1 ];then
  echo "No processes found ...sorry"
  exit 1
fi
while read Loop1 Loop2
do
 echo $Loop1 $Loop2
done<$HOLD1
echo -n "Are these the processes to be killed..."
read ANS
case $ANS in
Y|y)while read Loop
do
echo $Loop1
kill -9 $Loop1
done <$HOLD1
;;
n|N)
echo "No selected kill process!"
;;
esac
rm -f $HOLD1
[ 阅读全文 | 回复(0) | 引用通告 | 编辑

  Post  by  badboy 发表于 2006-12-16 16:43:00
发表评论:
数据载入中,请稍候......
数据载入中,请稍候......