blob: b50e8c60863fc2b56b73e05f3a8275f2f0831b42 [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 Shatovc9ec2312018-06-14 12:06:42 -040024echo "APP_VER =" $(python setup.py --version) | tee -a ${LOG_FILE}
25uname -a | tee -a ${LOG_FILE}
alex_sh9d980ce2017-08-23 17:30:56 -040026echo "/etc/hosts" | tee -a ${LOG_FILE}
27cat /etc/hosts | tee -a ${LOG_FILE}
Alex Shatovc9ec2312018-06-14 12:06:42 -040028pwd | tee -a ${LOG_FILE}
29
30python -m policyhandler >> ${LOG_FILE} 2>&1 &
alex_sh9d980ce2017-08-23 17:30:56 -040031PID=$!
32
alex_sh9d980ce2017-08-23 17:30:56 -040033function finish {
34 echo "killing policy_handler ${PID}" $(date +%Y_%m%d-%H:%M:%S.%N) | tee -a ${LOG_FILE}
35 kill -9 ${PID}
36 echo "killed policy_handler ${PID}" $(date +%Y_%m%d-%H:%M:%S.%N) | tee -a ${LOG_FILE}
37}
38trap finish SIGHUP SIGINT SIGTERM
39
Alex Shatov51052582018-05-18 15:13:40 -040040echo "running policy_handler as" ${PID} "log" ${LOG_FILE} | tee -a ${LOG_FILE}
Alex Shatov51052582018-05-18 15:13:40 -040041free -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)