ps grep awk 组合 应用

 

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值