ROBO usecase: Obj Detection service base framework
[ealt-edge.git] / example-apps / ROBO / aPaaS / Obj_Detection_service / configs / start.sh
1 #!/bin/bash
2 # Copyright 2020 Huawei Technologies Co., Ltd.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # Validates if ip is valid
17 validate_ip()
18 {
19
20
21 }
22
23 validate_name() {
24
25 }
26
27 # validates whether file exist
28 validate_file_exists() {
29
30 }
31
32 validate_ip "$LISTEN_IP"
33 valid_listen_ip="$?"
34 if [ ! "$valid_listen_ip" -eq "0" ]; then
35   echo "invalid ip address for listen ip"
36   exit 1
37 fi
38
39 if [ ! -z "$SERVER_NAME" ]; then
40   validate_name "$SERVER_NAME"
41   valid_name="$?"
42   if [ ! "$valid_name" -eq "0" ]; then
43     echo "invalid ssl server name"
44     exit 1
45   fi
46 fi
47
48 # ssl parameters validation
49 validate_file_exists "/usr/app/ssl/server_tls.crt"
50 valid_ssl_server_cert="$?"
51 if [ ! "$valid_ssl_server_cert" -eq "0" ]; then
52   echo "invalid ssl server certificate"
53   exit 1
54 fi
55
56 # ssl parameters validation
57 validate_file_exists "/usr/app/ssl/server_tls.key"
58 valid_ssl_server_key="$?"
59 if [ ! "$valid_ssl_server_key" -eq "0" ]; then
60   echo "invalid ssl server key"
61   exit 1
62 fi
63
64 # ssl parameters validation
65 validate_file_exists "/usr/app/ssl/ca.crt"
66 valid_ssl_ca_crt="$?"
67 if [ ! "$valid_ssl_ca_crt" -eq "0" ]; then
68   echo "invalid ssl ca cert"
69   exit 1
70 fi
71
72 echo "Running Monitoring Service"
73 umask 0027
74 cd /usr/app || exit
75 python run.py