#!/bin/bash
#date_5='awk 'BEGIN{print strftime("%H:%M",(systime()-300))}''
#ps -ef | grep phantomjs | grep webdriver | grep -v grep | awk '{print $5}' > phantomjs_date
# echo `date +%M` - `date -d "23:11" +%M` |bc 这个就是计算时间差
echo > date
for Time in `ps -ef | grep phantomjs | grep webdriver | grep -v grep | awk '{print $5}'`
do
echo `date +%M` - `date -d "${Time}" +%M` | bc >date
cat date | while read line
do
if [ $line -gt 2 ];then
#ps -ef | grep phantomjs | grep webdriver | grep $Time | grep -v grep | awk '{print $2}'
ps -ef | grep phantomjs | grep webdriver | grep $Time | grep -v grep | awk '{print $2}' | xargs kill -9
fi
done
done