Add support for sample testcase to get test result
[yardstick.git] / api / api-prepare.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 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 # nginx config
12 nginx_config='/etc/nginx/conf.d/yardstick.conf'
13
14 if [[ ! -e "${nginx_config}" ]];then
15
16     cat << EOF > "${nginx_config}"
17 server {
18     listen 5000;
19     server_name localhost;
20     index  index.htm index.html;
21     location / {
22         include uwsgi_params;
23         uwsgi_pass unix:///home/opnfv/repos/yardstick/api/yardstick.sock;
24     }
25 }
26 EOF
27 fi
28
29 # nginx service start when boot
30 cat << EOF >> /root/.bashrc
31
32 nginx_status=\$(service nginx status | grep not)
33 if [ -n "\${nginx_status}" ];then
34     service nginx restart
35     uwsgi -i /home/opnfv/repos/yardstick/api/yardstick.ini
36 fi
37 EOF