shell 计算时间差

#!/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
上一篇:js数组遍历(for in ,for of ,map,foreach,filter)的区别


下一篇:Android项目实战(二十):浅谈ListView悬浮头部展现效果