2 # Copyright 2015 AT&T Intellectual Properties
3 ##############################################################################
4 # Script to initialize the chef-repo branch and.chef
6 ##############################################################################
7 # Copy the certificates
8 echo 'Copying the *.crt provided in /shared folder'
9 cp --verbose /shared/*.crt /usr/local/share/ca-certificates
10 update-ca-certificates
12 echo 'Running in JBOSS'
16 if [ "$JBOSS_DEBUG" = true ] ; then
20 #Start the chef-solo if mso-docker.json contains some data.
21 if [ -s /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json ]
23 echo "mso-docker.json has some configuration, replay the recipes."
24 chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
26 echo "mso-docker.json is empty, do not replay the recipes."
29 JBOSS_PIDFILE=/tmp/jboss-standalone.pid
30 $JBOSS_HOME/bin/standalone.sh ${DEBUG} -c standalone-full-ha-mso.xml &
32 # Trap common signals and relay them to the jboss process
33 trap "kill -HUP $JBOSS_PID" HUP
34 trap "kill -TERM $JBOSS_PID" INT
35 trap "kill -QUIT $JBOSS_PID" QUIT
36 trap "kill -PIPE $JBOSS_PID" PIPE
37 trap "kill -TERM $JBOSS_PID" TERM
38 if [ "x$JBOSS_PIDFILE" != "x" ]; then
39 echo $JBOSS_PID > $JBOSS_PIDFILE
41 # Wait until the background process exits
43 while [ "$WAIT_STATUS" -ge 128 ]; do
44 wait $JBOSS_PID 2>/dev/null
46 if [ "$WAIT_STATUS" -gt 128 ]; then
47 SIGNAL=`expr $WAIT_STATUS - 128`
48 SIGNAL_NAME=`kill -l $SIGNAL`
49 echo "*** JBossAS process ($JBOSS_PID) received $SIGNAL_NAME signal ***" >&2
52 if [ "$WAIT_STATUS" -lt 127 ]; then
53 JBOSS_STATUS=$WAIT_STATUS
57 if [ "$JBOSS_STATUS" -ne 10 ]; then
58 # Wait for a complete shudown
59 wait $JBOSS_PID 2>/dev/null
61 if [ "x$JBOSS_PIDFILE" != "x" ]; then
62 grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE