#!/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