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