Merge "Change PTL informatin in INFO"
[bottlenecks.git] / testsuites / vstf / vstf_scripts / install.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 SERVER=$2
12 PORT=$3
13 if [ -e $SERVER ]
14 then
15     SERVER=""
16     echo "Use Default server."
17 fi
18
19 if [ -e $PORT ]
20 then
21     PORT=""
22     echo "Use Default port."
23 fi
24
25
26 killall vnstat
27 killall netserver
28 killall netperf
29 killall sar
30 rm -rf vstf.egg-info || exit 1
31 rm -rf build/ || exit 1
32 rm -rf /usr/local/lib/python2.7/dist-packages/vstf* || exit 1
33 python setup.py install --force
34 if [ $1 == "manager" ]; then
35     vstf-agent stop
36     vstf-manager stop
37     if [ "${SERVER}x" == "x" ]
38     then
39         vstf-manager start
40     else
41         if [ "${PORT}x" == "x" ]; then
42             vstf-manager start --monitor ${SERVER}
43         else
44             vstf-manager start --monitor ${SERVER} --port ${PORT}
45         fi
46     fi
47 elif [ $1 == "agent" ];then
48     vstf-manager stop
49     vstf-agent stop
50     vstf-agent start --config_file=/etc/vstf/amqp/amqp.ini
51 fi