alex_sh | 9d980ce | 2017-08-23 17:30:56 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Alex Shatov | a5bfd6a | 2017-09-15 14:03:13 -0400 | [diff] [blame] | 3 | # ============LICENSE_START======================================================= |
alex_sh | 9d980ce | 2017-08-23 17:30:56 -0400 | [diff] [blame] | 4 | # 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 | |
| 23 | mkdir -p logs |
| 24 | LOG_FILE=logs/policy_handler.log |
| 25 | echo "---------------------------------------------" >> ${LOG_FILE} 2>&1 |
Alex Shatov | 1369bea | 2018-01-10 11:00:50 -0500 | [diff] [blame] | 26 | export APP_VER=$(python setup.py --version) |
| 27 | echo "APP_VER=${APP_VER}" | tee -a ${LOG_FILE} |
| 28 | |
alex_sh | 9d980ce | 2017-08-23 17:30:56 -0400 | [diff] [blame] | 29 | echo "/etc/hosts" | tee -a ${LOG_FILE} |
| 30 | cat /etc/hosts | tee -a ${LOG_FILE} |
| 31 | python -m policyhandler/policy_handler >> ${LOG_FILE} 2>&1 & |
| 32 | PID=$! |
| 33 | |
| 34 | echo "running policy_handler as" ${PID} "log" ${LOG_FILE} | tee -a ${LOG_FILE} |
| 35 | function 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 | } |
| 40 | trap finish SIGHUP SIGINT SIGTERM |
| 41 | |
| 42 | wait ${PID} |
| 43 | echo "---------------------------------------------" >> ${LOG_FILE} 2>&1 |
| 44 | mv ${LOG_FILE} ${LOG_FILE}.$(date +%Y-%m-%d_%H%M%S) |