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 --fresh
12 echo 'Running in JBOSS'
15 #Start the chef-solo if mso-docker.json contains some data.
16 if [ -s /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json ]
18 echo "mso-docker.json has some configuration, replay the recipes."
19 chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
21 echo "mso-docker.json is empty, do not replay the recipes."
24 JBOSS_PIDFILE=/tmp/jboss-standalone.pid
25 $JBOSS_HOME/bin/standalone.sh -c standalone-full-ha-mso.xml &
27 # Trap common signals and relay them to the jboss process
28 trap "kill -HUP $JBOSS_PID" HUP
29 trap "kill -TERM $JBOSS_PID" INT
30 trap "kill -QUIT $JBOSS_PID" QUIT
31 trap "kill -PIPE $JBOSS_PID" PIPE
32 trap "kill -TERM $JBOSS_PID" TERM
33 if [ "x$JBOSS_PIDFILE" != "x" ]; then
34 echo $JBOSS_PID > $JBOSS_PIDFILE
36 # Wait until the background process exits
38 while [ "$WAIT_STATUS" -ge 128 ]; do
39 wait $JBOSS_PID 2>/dev/null
41 if [ "$WAIT_STATUS" -gt 128 ]; then
42 SIGNAL=`expr $WAIT_STATUS - 128`
43 SIGNAL_NAME=`kill -l $SIGNAL`
44 echo "*** JBossAS process ($JBOSS_PID) received $SIGNAL_NAME signal ***" >&2
47 if [ "$WAIT_STATUS" -lt 127 ]; then
48 JBOSS_STATUS=$WAIT_STATUS
52 if [ "$JBOSS_STATUS" -ne 10 ]; then
53 # Wait for a complete shudown
54 wait $JBOSS_PID 2>/dev/null
56 if [ "x$JBOSS_PIDFILE" != "x" ]; then
57 grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE