1 #!/bin/bash
2
3 args=1
4 e_wrongargs=65
5 e_wronguser=67
6
7 :${1?"this shell required an argument! "} # 参数1 不存在时 报错 并推出
8
9 pid=`ps -ef |grep "$1"|grep -v grep|awk '{print $2}'`
10 if [ "${#pid}" -gt 0 ]
11 then
12 for p in $pid ;
13 do
14 kill -9 $p
15 done
16
17 else
18 echo " this $1 pid is null."
19 fi
20 # ps ef|grep $1|grep -v grep|awk '{print $2 }'|xargs ki ll -9
21
22 exit 0
root 下 ./progress_kill.sh tomcat 可以杀掉指定进程
过滤tomcat 日志信息中的info debug ,获得exception
cat -n catalina.out|grep Exception|grep -v DEBUG|grep -v INFO|cat -n |awk '{$2="";print $0}' > /mnt/hgfs/share_file/exception.log
cat -n catalina.out|grep -v DEBUG|grep -v INFO|cat -n |awk '{$2="";print $0}' > /mnt/hgfs/share_file/exception.log