`
喜欢蓝色的我
  • 浏览: 359899 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

shell脚本,定时kill掉程序

 
阅读更多

#!/bin/bash
time_end=$(date '+%s' -d '3 minutes')
echo "time_end =" $time_end
while true
do
sleep 2
time_temp=$(date '+%s')
echo "time_temp =" $time_temp
if [ $time_temp -gt $time_end ];then
    echo "performance end 1111"
    su -c "ps -ef | grep jmeter | grep -v grep | cut -c 9-15 | xargs kill -s 9"
    echo "kill jmeter 2222"
    break 2
elif [ $time_temp -eq $time_end ];then
    echo "performance end 3333"
    su -c "ps -ef | grep jmeter | grep -v grep | cut -c 9-15 | xargs kill -s 9"
    echo "kill jmeter 4444"
    break 2
else
    echo "performance continue"

fi

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics