...
|
...
|
@@ -44,27 +44,22 @@ done |
|
|
|
|
|
PATH_JMETER_HOME="/opt/jmeter"
|
|
|
PATH_JMETER_LOG="/Data/logs/jmeter"
|
|
|
PATH_SHELL_LOG="${PATH_JMETER_LOG}/runtime.log"
|
|
|
if [ ! -f $PATH_SHELL_LOG ];then
|
|
|
echo 1
|
|
|
echo > $PATH_SHELL_LOG
|
|
|
fi
|
|
|
#CMD_PS_JMETER="ps -ef| grep -e \"${PATH_JMETER_HOME}/bin/jmeter.*-n.*-t.*-X\" -e \"java -server -XX:+HeapDumpOnOutOfMemoryError.*-XX:+CMSClassUnloadingEnabled -jar ${PATH_JMETER_HOME}/bin/ApacheJMeter.jar -n -t\" -e \"${PATH_JMETER_HOME}/bin/jmeter-server\" -e \"${PATH_JMETER_HOME}/bin/jmeter.*-Djava.rmi.server.hostname=\" -e \"java -server -XX:+HeapDumpOnOutOfMemoryError.*-jar ${PATH_JMETER_HOME}/bin/ApacheJMeter.jar -Dserver_port=\" | grep -v grep";
|
|
|
CMD_PS_JMETER="ps -ef | grep \"jar /opt/jmeter/bin/.*-n -t ${PATH_JMETER_HOME}${s}\" | grep -v grep"
|
|
|
CMD_KILL_JMETER="${CMD_PS_JMETER} | cut -c 9-15 | xargs kill -9 1>${PATH_SHELL_LOG} 2>&1"
|
|
|
CMD_CLEAR_JMETERLOG="echo > ${PATH_JMETER_LOG}/jmeter.jtl;echo > ${PATH_JMETER_LOG}/jmeterRun.log;echo > ${PATH_JMETER_LOG}/runtime.log; 1>${PATH_SHELL_LOG} 2>&1"
|
|
|
CMD_RESTART_MONITOR="${PATH_JMETER_HOME}/shell/restart_YPT_AUTO_MONITOR.sh 1>${PATH_SHELL_LOG} 2>&1"
|
|
|
CMD_STOP_MONITOR="${CMD_RESTART_MONITOR} stop 1>${PATH_SHELL_LOG} 2>&1"
|
|
|
#CMD_UPDATE_SVN="svn up ${PATH_JMETER_HOME} 1>${PATH_SHELL_LOG} 2>&1"
|
|
|
CMD_SYNC_SYSTEMTIME="ntpdate asia.pool.ntp.org 1>${PATH_SHELL_LOG} 2>&1"
|
|
|
CMD_KILL_JMETER="${CMD_PS_JMETER} | cut -c 9-15 | xargs kill -9"
|
|
|
CMD_CLEAR_JMETERLOG="echo > ${PATH_JMETER_LOG}/jmeter.jtl;echo > ${PATH_JMETER_LOG}/jmeterRun.log;echo > ${PATH_JMETER_LOG}/runtime.log;"
|
|
|
CMD_RESTART_MONITOR="${PATH_JMETER_HOME}/shell/restart_YPT_AUTO_MONITOR.sh"
|
|
|
CMD_STOP_MONITOR="${CMD_RESTART_MONITOR} stop"
|
|
|
#CMD_UPDATE_SVN="svn up ${PATH_JMETER_HOME}"
|
|
|
CMD_SYNC_SYSTEMTIME="ntpdate asia.pool.ntp.org"
|
|
|
|
|
|
HOST_NAME=$(hostname)
|
|
|
IP=$(/sbin/ip addr show | grep eth | grep inet | awk '{print $2}' | awk -F '/' '{print $1}')
|
|
|
|
|
|
function startJmeter(){
|
|
|
echo "[startJmeter]脚本路径:${PATH_JMETER_HOME}${s}" >> $PATH_SHELL_LOG
|
|
|
echo "[startJmeter]脚本路径:${PATH_JMETER_HOME}${s}"
|
|
|
#${PATH_JMETER_HOME}/bin/jmeter -n -t ${PATH_JMETER_HOME}${s} -l ${PATH_JMETER_LOG}/jmeter.jtl -j ${PATH_JMETER_LOG}/jmeterRun.log -X > ${PATH_JMETER_LOG}/runtime.log &
|
|
|
${PATH_JMETER_HOME}/bin/jmeter -n -t ${PATH_JMETER_HOME}${s} -l /dev/null -j ${PATH_JMETER_LOG}/jmeterRun.log -X > ${PATH_SHELL_LOG} &
|
|
|
${PATH_JMETER_HOME}/bin/jmeter -n -t ${PATH_JMETER_HOME}${s} -l /dev/null -j ${PATH_JMETER_LOG}/jmeterRun.log -X > ${PATH_JMETER_LOG}/runtime.log &
|
|
|
}
|
|
|
function stopJmeter(){
|
|
|
eval $CMD_KILL_JMETER
|
...
|
...
|
@@ -87,7 +82,7 @@ git reset --hard origin/master |
|
|
git pull
|
|
|
}
|
|
|
function modifyHosts(){
|
|
|
echo "[modifyHosts]HOSTS:127.0.0.1 localhost\n::1 localhost\n$IP $HOST_NAME\n$e" >> $PATH_SHELL_LOG
|
|
|
echo "[modifyHosts]HOSTS:127.0.0.1 localhost\n::1 localhost\n$IP $HOST_NAME\n$e"
|
|
|
echo -e "127.0.0.1 localhost\n::1 localhost\n$IP $HOST_NAME\n$e" > /etc/hosts
|
|
|
}
|
|
|
function syncSystemTime(){
|
...
|
...
|
@@ -95,7 +90,7 @@ eval $CMD_SYNC_SYSTEMTIME |
|
|
}
|
|
|
function runJmeter(){
|
|
|
START_TIME=$(date)
|
|
|
echo "[START][$START_TIME]-----------------------------" >> $PATH_SHELL_LOG
|
|
|
echo "[START][$START_TIME]-----------------------------"
|
|
|
stopJmeter
|
|
|
clearJmeterLogs
|
|
|
modifyHosts
|
...
|
...
|
@@ -105,7 +100,7 @@ restartMonitor |
|
|
syncSystemTime
|
|
|
|
|
|
startJmeter
|
|
|
echo "" >> $PATH_SHELL_LOG
|
|
|
echo "[Now Start!]"
|
|
|
}
|
|
|
if [ ! $c ];then
|
|
|
if [ ! $s ];then
|
...
|
...
|
@@ -117,5 +112,5 @@ else |
|
|
stopJmeter
|
|
|
stopMonitor
|
|
|
END_TIME=$(date)
|
|
|
echo "[STOPPED][$END_TIME]-----------------------------" >> $PATH_SHELL_LOG
|
|
|
echo "[STOPPED][$END_TIME]-----------------------------"
|
|
|
fi |
...
|
...
|
|