3 # Copyright 2015 AT&T Intellectual Properties
4 ##############################################################################
5 # Script to initialize the chef-repo branch and.chef
7 ##############################################################################
9 # Copy the certificates
10 echo 'Copying the *.crt provided in /shared folder'
11 cp --verbose /shared/*.crt /usr/local/share/ca-certificates
12 update-ca-certificates
14 echo 'Running in JBOSS'
18 if [ "$JBOSS_DEBUG" = true ] ; then
22 #Start the chef-solo if mso-docker.json contains some data.
23 if [ -s /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json ]
25 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]
28 echo "mso-docker.json is empty, do not replay the recipes."
31 JBOSS_PIDFILE=/tmp/jboss-standalone.pid
32 $JBOSS_HOME/bin/standalone.sh ${DEBUG} -c standalone-full-ha-mso.xml &
34 # Trap common signals and relay them to the jboss process
35 trap "kill -HUP $JBOSS_PID" HUP
36 trap "kill -TERM $JBOSS_PID" INT
37 trap "kill -QUIT $JBOSS_PID" QUIT
38 trap "kill -PIPE $JBOSS_PID" PIPE
39 trap "kill -TERM $JBOSS_PID" TERM
40 if [ "x$JBOSS_PIDFILE" != "x" ]; then
41 echo $JBOSS_PID > $JBOSS_PIDFILE
43 # Wait until the background process exits
45 while [ "$WAIT_STATUS" -ge 128 ]; do
46 wait $JBOSS_PID 2>/dev/null
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
54 if [ "$WAIT_STATUS" -lt 127 ]; then
55 JBOSS_STATUS=$WAIT_STATUS
59 if [ "$JBOSS_STATUS" -ne 10 ]; then
60 # Wait for a complete shudown
61 wait $JBOSS_PID 2>/dev/null
63 if [ "x$JBOSS_PIDFILE" != "x" ]; then
64 grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE