blob: 4bace3c8941a97540cc6facfb3f961a8cde0ae92 [file] [log] [blame]
alex_sh9d980ce2017-08-23 17:30:56 -04001#!/bin/bash
2
Alex Shatova5bfd6a2017-09-15 14:03:13 -04003# ============LICENSE_START=======================================================
alex_sh9d980ce2017-08-23 17:30:56 -04004# org.onap.dcae
5# ================================================================================
6# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7# ================================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19# ============LICENSE_END=========================================================
20#
21# ECOMP is a trademark and service mark of AT&T Intellectual Property.
22
23mkdir -p logs
24LOG_FILE=logs/policy_handler.log
25echo "---------------------------------------------" >> ${LOG_FILE} 2>&1
Alex Shatov1369bea2018-01-10 11:00:50 -050026export APP_VER=$(python setup.py --version)
27echo "APP_VER=${APP_VER}" | tee -a ${LOG_FILE}
28
alex_sh9d980ce2017-08-23 17:30:56 -040029echo "/etc/hosts" | tee -a ${LOG_FILE}
30cat /etc/hosts | tee -a ${LOG_FILE}
31python -m policyhandler/policy_handler >> ${LOG_FILE} 2>&1 &
32PID=$!
33
34echo "running policy_handler as" ${PID} "log" ${LOG_FILE} | tee -a ${LOG_FILE}
35function finish {
36 echo "killing policy_handler ${PID}" $(date +%Y_%m%d-%H:%M:%S.%N) | tee -a ${LOG_FILE}
37 kill -9 ${PID}
38 echo "killed policy_handler ${PID}" $(date +%Y_%m%d-%H:%M:%S.%N) | tee -a ${LOG_FILE}
39}
40trap finish SIGHUP SIGINT SIGTERM
41
42wait ${PID}
43echo "---------------------------------------------" >> ${LOG_FILE} 2>&1
44mv ${LOG_FILE} ${LOG_FILE}.$(date +%Y-%m-%d_%H%M%S)