杀掉超过5分钟以上的进程

运行时间是s
ps -eo pid,etime,args | grep mediainfo |awk 'BEGIN{split("1:60:3600:86400",t,":")}{n=split($2,a,"-|:");for(i=n;i;i--)s+=a[i]*t[n-i+1]}s>1800{print $1;s=0}' | xargs kill -9
ps -eo pid,comm,lstart | awk '$2=="mediainfo"' | awk '{"date -d \""$4" "$5" "$6" "$7"\" +%s" | getline t1;"date +%s" | getline t2;if(t2-t1>300)print $1}' | xargs kill -9

 

你可能感兴趣的:(进程)