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