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 chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
19 JBOSS_PIDFILE=/tmp/jboss-standalone.pid
20 $JBOSS_HOME/bin/standalone.sh -c standalone-full-ha-mso.xml &
22 # Trap common signals and relay them to the jboss process
23 trap "kill -HUP $JBOSS_PID" HUP
24 trap "kill -TERM $JBOSS_PID" INT
25 trap "kill -QUIT $JBOSS_PID" QUIT
26 trap "kill -PIPE $JBOSS_PID" PIPE
27 trap "kill -TERM $JBOSS_PID" TERM
28 if [ "x$JBOSS_PIDFILE" != "x" ]; then
29 echo $JBOSS_PID > $JBOSS_PIDFILE
31 # Wait until the background process exits
33 while [ "$WAIT_STATUS" -ge 128 ]; do
34 wait $JBOSS_PID 2>/dev/null
36 if [ "$WAIT_STATUS" -gt 128 ]; then
37 SIGNAL=`expr $WAIT_STATUS - 128`
38 SIGNAL_NAME=`kill -l $SIGNAL`
39 echo "*** JBossAS process ($JBOSS_PID) received $SIGNAL_NAME signal ***" >&2
42 if [ "$WAIT_STATUS" -lt 127 ]; then
43 JBOSS_STATUS=$WAIT_STATUS
47 if [ "$JBOSS_STATUS" -ne 10 ]; then
48 # Wait for a complete shudown
49 wait $JBOSS_PID 2>/dev/null
51 if [ "x$JBOSS_PIDFILE" != "x" ]; then
52 grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE