Merge "Concurrency testcases to be configured over cli"
[yardstick.git] / docker / supervisor.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2017 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 service start when boot
12 supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
13 rabbitmq_config='/etc/supervisor/conf.d/rabbitmq.conf'
14
15 if [[ ! -e "${supervisor_config}" ]]; then
16
17     cat << EOF > "${supervisor_config}"
18 [supervisord]
19 nodaemon = true
20
21 [program:nginx]
22 command = service nginx restart
23
24 [program:yardstick_uwsgi]
25 directory = /etc/yardstick
26 command = uwsgi -i yardstick.ini
27 EOF
28
29 fi
30
31 if [[ ! -e "${rabbitmq_config}" ]]; then
32
33     cat << EOF > "${rabbitmq_config}"
34 [program:rabbitmq]
35 command = /bin/bash -c "service rabbitmq-server restart
36     rabbitmqctl start_app
37     rabbitmqctl add_user yardstick yardstick
38     rabbitmqctl set_permissions -p / yardstick '.*' '.*'"
39 EOF
40
41 fi