blob: 5bbd187b055ee8aa10f02f8028279f902c721b25 [file] [log] [blame]
Mike Elliottd32d36e2018-02-12 15:54:03 -05001#!/bin/sh
Jakub Latusek44f0fdd2020-10-21 13:36:29 +02002{{/*
Mike Elliottd32d36e2018-02-12 15:54:03 -05003# Copyright 2015 AT&T Intellectual Properties
4##############################################################################
5# Script to initialize the chef-repo branch and.chef
6#
7##############################################################################
Jakub Latusek44f0fdd2020-10-21 13:36:29 +02008*/}}
Mike Elliottd32d36e2018-02-12 15:54:03 -05009# Copy the certificates
10echo 'Copying the *.crt provided in /shared folder'
11cp --verbose /shared/*.crt /usr/local/share/ca-certificates
12update-ca-certificates
13
14echo 'Running in JBOSS'
15su - jboss
16
17DEBUG=''
18if [ "$JBOSS_DEBUG" = true ] ; then
19 DEBUG="--debug"
20fi
21
22#Start the chef-solo if mso-docker.json contains some data.
23if [ -s /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json ]
24then
guillaume.lambert7bf306e2021-09-08 12:03:22 +020025 echo "mso-docker.json has some configuration, replay the recipes."
26 chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
Mike Elliottd32d36e2018-02-12 15:54:03 -050027else
guillaume.lambert7bf306e2021-09-08 12:03:22 +020028 echo "mso-docker.json is empty, do not replay the recipes."
Mike Elliottd32d36e2018-02-12 15:54:03 -050029fi
30
31JBOSS_PIDFILE=/tmp/jboss-standalone.pid
32$JBOSS_HOME/bin/standalone.sh ${DEBUG} -c standalone-full-ha-mso.xml &
33JBOSS_PID=$!
34# Trap common signals and relay them to the jboss process
35trap "kill -HUP $JBOSS_PID" HUP
36trap "kill -TERM $JBOSS_PID" INT
37trap "kill -QUIT $JBOSS_PID" QUIT
38trap "kill -PIPE $JBOSS_PID" PIPE
39trap "kill -TERM $JBOSS_PID" TERM
Guillaume Lambertcf0be432021-04-29 14:12:24 +020040if [ "$JBOSS_PIDFILE" != "" ]; then
Mike Elliottd32d36e2018-02-12 15:54:03 -050041 echo $JBOSS_PID > $JBOSS_PIDFILE
42fi
43# Wait until the background process exits
44WAIT_STATUS=128
45while [ "$WAIT_STATUS" -ge 128 ]; do
46 wait $JBOSS_PID 2>/dev/null
47 WAIT_STATUS=$?
48 if [ "$WAIT_STATUS" -gt 128 ]; then
49 SIGNAL=`expr $WAIT_STATUS - 128`
50 SIGNAL_NAME=`kill -l $SIGNAL`
51 echo "*** JBossAS process ($JBOSS_PID) received $SIGNAL_NAME signal ***" >&2
52 fi
53done
54if [ "$WAIT_STATUS" -lt 127 ]; then
55 JBOSS_STATUS=$WAIT_STATUS
56else
57 JBOSS_STATUS=0
58fi
59if [ "$JBOSS_STATUS" -ne 10 ]; then
60 # Wait for a complete shudown
61 wait $JBOSS_PID 2>/dev/null
62fi
Guillaume Lambertcf0be432021-04-29 14:12:24 +020063if [ "$JBOSS_PIDFILE" != "" ]; then
Mike Elliottd32d36e2018-02-12 15:54:03 -050064 grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE
65fi