startGor.sh 700 Bytes
#!/bin/bash

if [[ ! $1 ]];then
  echo "未输入日志全路径"
  exit 1
fi
if [[ ! $2 ]];then
  echo "未输入回放倍数"
  exit 1
fi
if [[ ! $3 ]];then
  echo "未输入回放域名"
  exit 1
fi

HOST=""
if [[ $4 ]];then
  HOST=$4
fi
HOST_NAME=$(hostname)
IP=$(/sbin/ip addr show | grep -e eth -e p4p | grep inet | awk '{print $2}' | awk -F '/' '{print $1}')
HOST=$(echo $HOST | sed 's/,/\\n/g')
HOST="127.0.0.1      localhost\n::1  localhost\n${IP}  ${HOST_NAME}\n${HOST}"
echo -e $HOST > /etc/hosts

basepath=$(cd `dirname $0`; pwd)
LOG_PATH=/Data/logs/jmeter/gor.log

${basepath}/gor --stats --output-http-stats --input-file-loop --input-file "$1|$2" --output-http "$3" 1>$LOG_PATH 2>&1 &