3 # Copyright 2017, Nokia Corporation
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
19 CONFIG_LOCATION=/service/application.properties
22 echo "Recieved sutdown signal"
23 if [ ! -e /proc/$PID ] ; then
24 echo "The process already exited $PID"
27 echo "Sending shutdown signal to $PID"
29 for i in `seq 0 20`; do
30 if [ ! -e /proc/$PID ] ; then
31 echo "The driver exited normally $PID"
36 echo "Terminating the driver forcefully $PID"
40 function switchLine(){
43 if [ ! -z $REPLACEMENT ]; then
44 sed -i "s/${PATTERN}.*/${PATTERN}/g" $CONFIG_LOCATION
45 sed -i "s|${PATTERN}|${PATTERN}=${REPLACEMENT}|g" $CONFIG_LOCATION
50 if [ ! -z "$CONFIGURE" ] ; then
51 switchLine driverMsbExternalIp $EXTERNAL_IP
52 switchLine driverVnfmExternalIp $EXTERNAL_IP
53 switchLine messageBusIp $MSB_IP
54 switchLine cbamCatalogUrl $CBAM_CATALOG_URL
55 switchLine cbamLcnUrl $CBAM_LCN_URL
56 switchLine cbamKeyCloakBaseUrl $CBAM_KEYCLOAK_URL
57 switchLine cbamLcnUrl $CBAM_LCN_URL
58 switchLine cbamUsername $CBAM_USERNAME
59 switchLine cbamPassword $CBAM_PASSWORD
60 switchLine vnfmId $VNFM_ID
61 switchLine ipMap $IP_MAP
66 #during shutdown signal the ervice to stop
67 trap shutdown SIGINT SIGTERM
69 #configure if required
76 echo "Starting server"
77 java -jar driver.war --spring.config.location=file:/service/application.properties &>> /service/service.log &
79 echo "Server process started in background with id $PID"
80 while test -e /proc/$PID; do
83 echo "Server quit (unexpected)"