summaryrefslogtreecommitdiffstats
path: root/vstf/install.sh
blob: 10a46f4c90fe49b55f88892b976596ca4dc9c9ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

SERVER=$2
PORT=$3
if [ -e $SERVER ]
then
    SERVER=""
    echo "Use Default server."
fi

if [ -e $PORT ]
then
    PORT=""
    echo "Use Default port."
fi


killall vnstat
killall netserver
killall netperf
killall sar
rm -rf vstf.egg-info || exit 1
rm -rf build/ || exit 1
rm -rf /usr/local/lib/python2.7/dist-packages/vstf* || exit 1
python setup.py install --force
if [ $1 == "manager" ]; then
    vstf-agent stop
    vstf-manager stop
    if [ "${SERVER}x" == "x" ]
    then
        vstf-manager start
    else
        if [ "${PORT}x" == "x" ]; then
            vstf-manager start --monitor ${SERVER}
        else
            vstf-manager start --monitor ${SERVER} --port ${PORT}
        fi
    fi
elif [ $1 == "agent" ];then
    vstf-manager stop
    vstf-agent stop
    vstf-agent start --config_file=/etc/vstf/amqp/amqp.ini
fi