检测进程使用cpu时间超过5分钟,kill进程
#!/bin/bash
for PID in `ps -A |egrep "aaa|bbb|ccc"|awk '{split($3,tab,/:/); if(tab[2]+tab[1]*60>=5) {print $1}}'`
do
echo $PID
kill -9 $PID
done
~
#!/bin/bash
for PID in `ps -A |egrep "aaa|bbb|ccc"|awk '{split($3,tab,/:/); if(tab[2]+tab[1]*60>=5) {print $1}}'`
do
echo $PID
kill -9 $PID
done
~