#!/bin/bash
IP=${1:-localhost}
QINGQIU1=`curl -s  http://${IP}/status | awk '/server accepts handled requests/ {getline a;split(a,s); print s[length(s)]}'`
sleep 5
QINGQIU2=`curl -s  http://${IP}/status | awk '/server accepts handled requests/ {getline a;split(a,s); print s[length(s)]}'`

if [ $QINGQIU2 > 0 ]
then
QINGQIU=`expr $QINGQIU2 - $QINGQIU1`
PER=`expr $QINGQIU / 5`
echo "The nginx request is ${PER} per second"
fi
